in src/main/java/org/apache/sling/maven/slingstart/ModelPreprocessor.java [233:290]
private void addDependenciesFromModel(
final Environment env,
final ProjectInfo info,
final String scope)
throws MavenExecutionException {
if ( info.project.getPackaging().equals(BuildConstants.PACKAGING_SLINGSTART ) ) {
// add base artifact if defined in current model
final org.apache.sling.provisioning.model.Artifact baseArtifact = ModelUtils.findBaseArtifact(info.model);
final String[] classifiers = new String[] {null, BuildConstants.CLASSIFIER_APP, BuildConstants.CLASSIFIER_WEBAPP};
for(final String c : classifiers) {
final Dependency dep = new Dependency();
dep.setGroupId(baseArtifact.getGroupId());
dep.setArtifactId(baseArtifact.getArtifactId());
dep.setVersion(baseArtifact.getVersion());
dep.setType(baseArtifact.getType());
dep.setClassifier(c);
if ( BuildConstants.CLASSIFIER_WEBAPP.equals(c) ) {
dep.setType(BuildConstants.TYPE_WAR);
}
dep.setScope(scope);
info.project.getDependencies().add(dep);
env.logger.debug("- adding base dependency " + ModelUtils.toString(dep));
}
}
for(final Feature feature : info.model.getFeatures()) {
// skip launchpad feature
if ( feature.getName().equals(ModelConstants.FEATURE_LAUNCHPAD) ) {
continue;
}
for(final RunMode runMode : feature.getRunModes()) {
for(final ArtifactGroup group : runMode.getArtifactGroups()) {
for(final org.apache.sling.provisioning.model.Artifact a : group) {
if ( a.getGroupId().equals(info.project.getGroupId())
&& a.getArtifactId().equals(info.project.getArtifactId())
&& a.getVersion().equals(info.project.getVersion()) ) {
// skip artifact from the same project
env.logger.debug("- skipping dependency " + a.toMvnUrl());
continue;
}
final Dependency dep = new Dependency();
dep.setGroupId(a.getGroupId());
dep.setArtifactId(a.getArtifactId());
dep.setVersion(a.getVersion());
dep.setType(a.getType());
dep.setClassifier(a.getClassifier());
dep.setScope(scope);
env.logger.debug("- adding dependency " + ModelUtils.toString(dep));
info.project.getDependencies().add(dep);
}
}
}
}
}