This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to annotated tag slingstart-maven-plugin-1.7.4 in repository https://gitbox.apache.org/repos/asf/sling-slingstart-maven-plugin.git
commit 058ea4dcaa6720ea2a2949dec627f4a3ecda9bc5 Author: Carsten Ziegeler <[email protected]> AuthorDate: Tue Feb 28 10:35:00 2017 +0000 SLING-6573 : Repository goal should not require a launchpad feature git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/tooling/maven/slingstart-maven-plugin@1784720 13f79535-47bb-0310-9956-ffa450edef68 --- .../sling/maven/slingstart/RepositoryMojo.java | 45 ++++++++++++++++------ 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/src/main/java/org/apache/sling/maven/slingstart/RepositoryMojo.java b/src/main/java/org/apache/sling/maven/slingstart/RepositoryMojo.java index 845c67a..1bc601b 100644 --- a/src/main/java/org/apache/sling/maven/slingstart/RepositoryMojo.java +++ b/src/main/java/org/apache/sling/maven/slingstart/RepositoryMojo.java @@ -32,10 +32,12 @@ import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.ResolutionScope; import org.apache.sling.provisioning.model.ArtifactGroup; import org.apache.sling.provisioning.model.Feature; import org.apache.sling.provisioning.model.Model; +import org.apache.sling.provisioning.model.ModelConstants; import org.apache.sling.provisioning.model.ModelUtility; import org.apache.sling.provisioning.model.RunMode; import org.apache.sling.provisioning.model.io.ModelWriter; @@ -62,6 +64,12 @@ public class RepositoryMojo extends AbstractSlingStartMojo { @Component private ArtifactResolver resolver; + /** + * This is the name of the final model as written to the target directory. + */ + @Parameter(defaultValue="slingstart.txt") + private String repositoryModelName; + @Override public void execute() throws MojoExecutionException, MojoFailureException { final File artifactDir = new File(this.project.getBuild().getDirectory(), DIR_NAME); @@ -79,18 +87,20 @@ public class RepositoryMojo extends AbstractSlingStartMojo { } } } - // base artifact - try { - final org.apache.sling.provisioning.model.Artifact baseArtifact = ModelUtils.findBaseArtifact(model); - final org.apache.sling.provisioning.model.Artifact appArtifact = - new org.apache.sling.provisioning.model.Artifact(baseArtifact.getGroupId(), - baseArtifact.getArtifactId(), - baseArtifact.getVersion(), - BuildConstants.CLASSIFIER_APP, - BuildConstants.TYPE_JAR); - copyArtifactToRepository(appArtifact, artifactDir); - } catch ( final MavenExecutionException mee) { - throw new MojoExecutionException(mee.getMessage(), mee.getCause()); + // base artifact - only if launchpad feature is available + if (model.getFeature(ModelConstants.FEATURE_LAUNCHPAD) != null) { + try { + final org.apache.sling.provisioning.model.Artifact baseArtifact = ModelUtils.findBaseArtifact(model); + final org.apache.sling.provisioning.model.Artifact appArtifact = + new org.apache.sling.provisioning.model.Artifact(baseArtifact.getGroupId(), + baseArtifact.getArtifactId(), + baseArtifact.getVersion(), + BuildConstants.CLASSIFIER_APP, + BuildConstants.TYPE_JAR); + copyArtifactToRepository(appArtifact, artifactDir); + } catch ( final MavenExecutionException mee) { + throw new MojoExecutionException(mee.getMessage(), mee.getCause()); + } } // models Model rawModel = ProjectHelper.getRawModel(this.project); @@ -121,6 +131,17 @@ public class RepositoryMojo extends AbstractSlingStartMojo { IOUtils.closeQuietly(writer); } + // and write model to target + writer = null; + try { + writer = new FileWriter(new File(this.project.getBuild().getDirectory(), repositoryModelName)); + ModelWriter.write(writer, rawModel); + } catch (IOException e) { + throw new MojoExecutionException("Unable to write model to " + rawModelFile, e); + } finally { + IOUtils.closeQuietly(writer); + } + for(final Map.Entry<String, String> entry : ProjectHelper.getDependencyModel(this.project).entrySet()) { final org.apache.sling.provisioning.model.Artifact modelDepArtifact = org.apache.sling.provisioning.model.Artifact.fromMvnUrl(entry.getKey()); final String modelClassifier = (modelDepArtifact.getType().equals(BuildConstants.PACKAGING_SLINGSTART) ? BuildConstants.PACKAGING_PARTIAL_SYSTEM : modelDepArtifact.getClassifier()); -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
