You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 10:26:50 UTC
[sling-slingstart-maven-plugin] 09/16: SLING-4879 update variables
section in feature for attached artifact instead of using effective model
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag slingstart-maven-plugin-1.3.0
in repository https://gitbox.apache.org/repos/asf/sling-slingstart-maven-plugin.git
commit 55bf1b1c4914f5020326739bc60fb71780909178
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Tue Jul 14 10:17:41 2015 +0000
SLING-4879 update variables section in feature for attached artifact instead of using effective model
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/tooling/maven/slingstart-maven-plugin@1690898 13f79535-47bb-0310-9956-ffa450edef68
---
.../maven/slingstart/AbstractSlingStartMojo.java | 25 +++-------------------
.../maven/slingstart/AttachSlingStartModel.java | 11 +++++-----
.../sling/maven/slingstart/PreparePackageMojo.java | 15 +++++++++++++
3 files changed, 24 insertions(+), 27 deletions(-)
diff --git a/src/main/java/org/apache/sling/maven/slingstart/AbstractSlingStartMojo.java b/src/main/java/org/apache/sling/maven/slingstart/AbstractSlingStartMojo.java
index 08812ae..766e434 100644
--- a/src/main/java/org/apache/sling/maven/slingstart/AbstractSlingStartMojo.java
+++ b/src/main/java/org/apache/sling/maven/slingstart/AbstractSlingStartMojo.java
@@ -24,7 +24,6 @@ import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectHelper;
-import org.apache.sling.provisioning.model.ModelUtility.ResolverOptions;
/**
* Base class for all slingstart mojos.
@@ -48,39 +47,21 @@ public abstract class AbstractSlingStartMojo extends AbstractMojo {
/**
* If set to true, properties from the Maven POM can be used as variables in the provisioning files.
+ * The resolved variables are added to the generated provisioning file, so other tools using this model
+ * do not have to resolve them themselves.
*/
@Parameter(defaultValue="false")
protected boolean usePomVariables;
/**
- * If set to true, Artifact dependencies from provisioning file without explict version are tried
+ * If set to true, Artifact dependencies from provisioning file without explicit version are tried
* to be resolved against the dependency versions from the Maven POM.
*/
@Parameter(defaultValue="false")
protected boolean usePomDependencies;
- /**
- * If set to true, the effective provisioning models with all variables replaced is attached instead of the raw model.
- */
- @Parameter(defaultValue="false")
- protected boolean attachEffectiveModel;
-
protected File getTmpDir() {
return new File(this.project.getBuild().getDirectory(), "slingstart-tmp");
}
- /**
- * @return Variable to be used when building an effective provisioning model.
- */
- protected ResolverOptions getResolverOptions() {
- ResolverOptions options = new ResolverOptions();
- if (usePomVariables) {
- options.variableResolver(new PomVariableResolver(project));
- }
- if (usePomDependencies) {
- options.artifactVersionResolver(new PomArtifactVersionResolver(project));
- }
- return options;
- }
-
}
diff --git a/src/main/java/org/apache/sling/maven/slingstart/AttachSlingStartModel.java b/src/main/java/org/apache/sling/maven/slingstart/AttachSlingStartModel.java
index b336791..d6eac24 100644
--- a/src/main/java/org/apache/sling/maven/slingstart/AttachSlingStartModel.java
+++ b/src/main/java/org/apache/sling/maven/slingstart/AttachSlingStartModel.java
@@ -28,6 +28,7 @@ import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.ResolutionScope;
import org.apache.sling.provisioning.model.Model;
+import org.apache.sling.provisioning.model.ModelUtility;
import org.apache.sling.provisioning.model.io.ModelWriter;
/**
@@ -43,12 +44,12 @@ public class AttachSlingStartModel extends AbstractSlingStartMojo {
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
- final Model model;
- if (attachEffectiveModel) {
- model = ProjectHelper.getEffectiveModel(this.project, getResolverOptions());
+ Model model = ProjectHelper.getRawModel(this.project);
+ if (usePomVariables) {
+ model = ModelUtility.applyVariables(model, new PomVariableResolver(project));
}
- else {
- model = ProjectHelper.getRawModel(this.project);
+ if (usePomDependencies) {
+ // TODO: implement applyDependencies
}
// write the model
diff --git a/src/main/java/org/apache/sling/maven/slingstart/PreparePackageMojo.java b/src/main/java/org/apache/sling/maven/slingstart/PreparePackageMojo.java
index 11b372e..677398f 100644
--- a/src/main/java/org/apache/sling/maven/slingstart/PreparePackageMojo.java
+++ b/src/main/java/org/apache/sling/maven/slingstart/PreparePackageMojo.java
@@ -43,6 +43,7 @@ import org.apache.sling.provisioning.model.Configuration;
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.ResolverOptions;
import org.apache.sling.provisioning.model.RunMode;
import org.codehaus.plexus.archiver.ArchiverException;
import org.codehaus.plexus.archiver.UnArchiver;
@@ -98,6 +99,20 @@ public class PreparePackageMojo extends AbstractSlingStartMojo {
this.prepareWebapp(model);
}
+ /**
+ * @return Resolving options to be used when building an effective provisioning model.
+ */
+ protected ResolverOptions getResolverOptions() {
+ ResolverOptions options = new ResolverOptions();
+ if (usePomVariables) {
+ options.variableResolver(new PomVariableResolver(project));
+ }
+ if (usePomDependencies) {
+ options.artifactVersionResolver(new PomArtifactVersionResolver(project));
+ }
+ return options;
+ }
+
protected File getStandaloneOutputDirectory() {
return new File(this.project.getBuild().getOutputDirectory());
}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.