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 09:16:21 UTC
[sling-maven-launchpad-plugin] 09/29: trivial formatting and field
name change
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag maven-launchpad-plugin-2.1.2
in repository https://gitbox.apache.org/repos/asf/sling-maven-launchpad-plugin.git
commit 52fb2008acb10bf3469524d75909a32407bd7029
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Fri Nov 4 15:46:50 2011 +0000
trivial formatting and field name change
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@1197607 13f79535-47bb-0310-9956-ffa450edef68
---
.../AbstractLaunchpadStartingMojo.java | 4 +-
.../AbstractUsingBundleListMojo.java | 28 +-
.../maven/projectsupport/AttachBundleListMojo.java | 2 +-
.../AttachPartialBundleListMojo.java | 10 +-
.../CheckBundleListForSnapshotsMojo.java | 2 +-
.../maven/projectsupport/CreateBundleJarMojo.java | 286 ++++++++++-----------
.../CreateKarafFeatureDescriptorMojo.java | 2 +-
.../maven/projectsupport/OutputBundleListMojo.java | 2 +-
.../maven/projectsupport/PreparePackageMojo.java | 282 ++++++++++----------
.../projectsupport/ValidateBundleListMojo.java | 12 +-
10 files changed, 315 insertions(+), 315 deletions(-)
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java
index 2cf52d5..f16fa2a 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java
@@ -108,7 +108,7 @@ public abstract class AbstractLaunchpadStartingMojo extends AbstractUsingBundleL
public Iterator<String> getChildren(String path) {
if (path.equals(BUNDLE_PATH_PREFIX)) {
final Set<String> levels = new HashSet<String>();
- for (final StartLevel level : getBundleList().getStartLevels()) {
+ for (final StartLevel level : getInitializedBundleList().getStartLevels()) {
// we treat the boot level as level 1
if ( level.getStartLevel() == -1 ) {
levels.add(BUNDLE_PATH_PREFIX + "/1/");
@@ -148,7 +148,7 @@ public abstract class AbstractLaunchpadStartingMojo extends AbstractUsingBundleL
final int startLevel = Integer.parseInt(startLevelInfo);
final List<String> bundles = new ArrayList<String>();
- for (final StartLevel level : getBundleList().getStartLevels()) {
+ for (final StartLevel level : getInitializedBundleList().getStartLevels()) {
if (level.getStartLevel() == startLevel || (startLevel == 1 && level.getStartLevel() == -1)) {
for (final Bundle bundle : level.getBundles()) {
final ArtifactDefinition d = new ArtifactDefinition(bundle, startLevel);
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/AbstractUsingBundleListMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/AbstractUsingBundleListMojo.java
index 56cc6c9..eb87a93 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/AbstractUsingBundleListMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/AbstractUsingBundleListMojo.java
@@ -81,7 +81,7 @@ public abstract class AbstractUsingBundleListMojo extends AbstractBundleListMojo
*/
private ArtifactDefinition[] additionalBundles;
- private BundleList bundleList;
+ private BundleList initializedBundleList;
/**
* Bundles which should be removed from the project's bundles directory.
@@ -164,8 +164,8 @@ public abstract class AbstractUsingBundleListMojo extends AbstractBundleListMojo
*/
protected abstract void executeWithArtifacts() throws MojoExecutionException, MojoFailureException;
- protected BundleList getBundleList() {
- return bundleList;
+ protected BundleList getInitializedBundleList() {
+ return initializedBundleList;
}
/**
@@ -211,30 +211,30 @@ public abstract class AbstractUsingBundleListMojo extends AbstractBundleListMojo
private final void initBundleList() throws IOException, XmlPullParserException, MojoExecutionException {
initArtifactDefinitions();
if (isCurrentArtifact(defaultBundleList)) {
- bundleList = readBundleList(bundleListFile);
+ initializedBundleList = readBundleList(bundleListFile);
} else {
- bundleList = new BundleList();
+ initializedBundleList = new BundleList();
if (includeDefaultBundles) {
Artifact defBndListArtifact = getArtifact(defaultBundleList.getGroupId(),
defaultBundleList.getArtifactId(), defaultBundleList.getVersion(), defaultBundleList.getType(),
defaultBundleList.getClassifier());
getLog().info("Using bundle list file from " + defBndListArtifact.getFile().getAbsolutePath());
- bundleList = readBundleList(defBndListArtifact.getFile());
+ initializedBundleList = readBundleList(defBndListArtifact.getFile());
}
if (bundleListFile.exists()) {
- bundleList.merge(readBundleList(bundleListFile));
+ initializedBundleList.merge(readBundleList(bundleListFile));
}
}
if (additionalBundles != null) {
for (ArtifactDefinition def : additionalBundles) {
- bundleList.add(def.toBundle());
+ initializedBundleList.add(def.toBundle());
}
}
- addDependencies(bundleList);
+ addDependencies(initializedBundleList);
if (bundleExclusions != null) {
for (ArtifactDefinition def : bundleExclusions) {
- bundleList.remove(def.toBundle(), false);
+ initializedBundleList.remove(def.toBundle(), false);
}
}
@@ -244,7 +244,7 @@ public abstract class AbstractUsingBundleListMojo extends AbstractBundleListMojo
getLog().info(
String.format("merging partial bundle list for %s:%s:%s", artifact.getGroupId(),
artifact.getArtifactId(), artifact.getVersion()));
- bundleList.merge(readBundleList(artifact.getFile()));
+ initializedBundleList.merge(readBundleList(artifact.getFile()));
// check for configuration artifact
Artifact cfgArtifact = null;
@@ -302,11 +302,11 @@ public abstract class AbstractUsingBundleListMojo extends AbstractBundleListMojo
}
- initBundleList(bundleList);
+ initBundleList(initializedBundleList);
- interpolateProperties(bundleList);
+ interpolateProperties(initializedBundleList);
- rewriteBundleList(bundleList);
+ rewriteBundleList(initializedBundleList);
}
private void rewriteBundleList(BundleList bundleList) throws MojoExecutionException {
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/AttachBundleListMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/AttachBundleListMojo.java
index dc5505c..9cebe53 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/AttachBundleListMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/AttachBundleListMojo.java
@@ -49,7 +49,7 @@ public class AttachBundleListMojo extends AbstractUsingBundleListMojo {
FileWriter fw = null;
try {
fw = new FileWriter(outputFile);
- writer.write(fw, getBundleList());
+ writer.write(fw, getInitializedBundleList());
projectHelper.attachArtifact(project, TYPE, CLASSIFIER, outputFile);
} catch (IOException e) {
throw new MojoExecutionException("Unable to output effective bundle list", e);
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/AttachPartialBundleListMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/AttachPartialBundleListMojo.java
index ed2c8ac..3c34afa 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/AttachPartialBundleListMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/AttachPartialBundleListMojo.java
@@ -72,24 +72,24 @@ public class AttachPartialBundleListMojo extends AbstractBundleListMojo {
private ZipArchiver zipArchiver;
public void execute() throws MojoExecutionException, MojoFailureException {
- final BundleList bundleList;
+ final BundleList initializedBundleList;
if (bundleListFile.exists()) {
try {
- bundleList = readBundleList(bundleListFile);
+ initializedBundleList = readBundleList(bundleListFile);
} catch (IOException e) {
throw new MojoExecutionException("Unable to read bundle list file", e);
} catch (XmlPullParserException e) {
throw new MojoExecutionException("Unable to read bundle list file", e);
}
} else {
- bundleList = new BundleList();
+ initializedBundleList = new BundleList();
}
- addDependencies(bundleList);
+ addDependencies(initializedBundleList);
BundleListXpp3Writer writer = new BundleListXpp3Writer();
try {
- writer.write(new FileWriter(bundleListOutput), bundleList);
+ writer.write(new FileWriter(bundleListOutput), initializedBundleList);
} catch (IOException e) {
throw new MojoExecutionException("Unable to write bundle list", e);
}
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/CheckBundleListForSnapshotsMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/CheckBundleListForSnapshotsMojo.java
index 9c6b97b..aeebc61 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/CheckBundleListForSnapshotsMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/CheckBundleListForSnapshotsMojo.java
@@ -44,7 +44,7 @@ public class CheckBundleListForSnapshotsMojo extends AbstractUsingBundleListMojo
@Override
protected void executeWithArtifacts() throws MojoExecutionException, MojoFailureException {
List<Bundle> snapshots = new ArrayList<Bundle>();
- BundleList bundleList = getBundleList();
+ BundleList bundleList = getInitializedBundleList();
for (StartLevel level : bundleList.getStartLevels()) {
for (Bundle bundle : level.getBundles()) {
if (isSnapshot(bundle)) {
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/CreateBundleJarMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/CreateBundleJarMojo.java
index b1b22b0..a969d81 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/CreateBundleJarMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/CreateBundleJarMojo.java
@@ -41,148 +41,148 @@ import org.codehaus.plexus.util.DirectoryScanner;
*/
public class CreateBundleJarMojo extends AbstractLaunchpadFrameworkMojo {
- /**
- * The list of resources we want to add to the bundle JAR file.
- *
- * @parameter
- */
- private Resource[] resources;
-
- /**
- * The output directory.
- *
- * @parameter default-value="${project.build.directory}"
- */
- private File outputDirectory;
-
- /**
- * Name of the generated JAR.
- *
- * @parameter default-value="${project.artifactId}-${project.version}"
- * @required
- */
- private String jarName;
-
- /**
- * The Jar archiver.
- *
- * @component role="org.codehaus.plexus.archiver.Archiver" roleHint="jar"
- */
- private JarArchiver jarArchiver;
-
- private static final String CLASSIFIER = "bundles";
-
- public static final String[] DEFAULT_INCLUDES = { "**/**" };
-
- private void addBundles() throws MojoExecutionException {
- BundleList bundles = getBundleList();
-
- for (StartLevel level : bundles.getStartLevels()) {
- for (Bundle bundle : level.getBundles()) {
- Artifact artifact = getArtifact(new ArtifactDefinition(bundle,
- level.getStartLevel()));
- final String destFileName = getPathForArtifact(level.getStartLevel(), artifact.getFile().getName());
- try {
- jarArchiver.addFile(artifact.getFile(), destFileName);
- } catch (ArchiverException e) {
- throw new MojoExecutionException(
- "Unable to add file to bundle jar file: "
- + artifact.getFile().getAbsolutePath(), e);
- }
- }
- }
- }
-
- private void addResources(Resource resource) throws MojoExecutionException {
- getLog().info(
- String.format("Adding resources [%s] to [%s]", resource
- .getDirectory(), resource.getTargetPath()));
- String[] fileNames = getFilesToCopy(resource);
- for (int i = 0; i < fileNames.length; i++) {
- String targetFileName = fileNames[i];
- if (resource.getTargetPath() != null) {
- targetFileName = resource.getTargetPath() + File.separator
- + targetFileName;
- }
-
- try {
- jarArchiver.addFile(new File(resource.getDirectory(),
- fileNames[i]), targetFileName);
- } catch (ArchiverException e) {
- throw new MojoExecutionException(
- "Unable to add resources to JAR file", e);
- }
-
- }
- }
-
- private File createJARFile() throws MojoExecutionException {
- File jarFile = new File(outputDirectory, jarName + "-" + CLASSIFIER
- + "." + JAR);
- jarArchiver.setDestFile(jarFile);
-
- addBundles();
- addResources();
-
- try {
- jarArchiver.createArchive();
- } catch (ArchiverException e) {
- throw new MojoExecutionException(
- "Unable to create bundle jar file", e);
- } catch (IOException e) {
- throw new MojoExecutionException(
- "Unable to create bundle jar file", e);
- }
-
- return jarFile;
- }
-
- private void addResources() throws MojoExecutionException {
- if (resources != null) {
- for (Resource resource : resources) {
- if (!(new File(resource.getDirectory())).isAbsolute()) {
- resource.setDirectory(project.getBasedir() + File.separator
- + resource.getDirectory());
- }
- addResources(resource);
- }
- }
- }
-
- @Override
- protected void executeWithArtifacts() throws MojoExecutionException,
- MojoFailureException {
- File jarFile = createJARFile();
- projectHelper.attachArtifact(project, JAR, CLASSIFIER, jarFile);
- }
-
- /**
- * Returns a list of filenames that should be copied over to the destination
- * directory.
- *
- * @param resource
- * the resource to be scanned
- * @return the array of filenames, relative to the sourceDir
- */
- @SuppressWarnings("unchecked")
+ /**
+ * The list of resources we want to add to the bundle JAR file.
+ *
+ * @parameter
+ */
+ private Resource[] resources;
+
+ /**
+ * The output directory.
+ *
+ * @parameter default-value="${project.build.directory}"
+ */
+ private File outputDirectory;
+
+ /**
+ * Name of the generated JAR.
+ *
+ * @parameter default-value="${project.artifactId}-${project.version}"
+ * @required
+ */
+ private String jarName;
+
+ /**
+ * The Jar archiver.
+ *
+ * @component role="org.codehaus.plexus.archiver.Archiver" roleHint="jar"
+ */
+ private JarArchiver jarArchiver;
+
+ private static final String CLASSIFIER = "bundles";
+
+ public static final String[] DEFAULT_INCLUDES = { "**/**" };
+
+ private void addBundles() throws MojoExecutionException {
+ BundleList bundles = getInitializedBundleList();
+
+ for (StartLevel level : bundles.getStartLevels()) {
+ for (Bundle bundle : level.getBundles()) {
+ Artifact artifact = getArtifact(new ArtifactDefinition(bundle,
+ level.getStartLevel()));
+ final String destFileName = getPathForArtifact(level.getStartLevel(), artifact.getFile().getName());
+ try {
+ jarArchiver.addFile(artifact.getFile(), destFileName);
+ } catch (ArchiverException e) {
+ throw new MojoExecutionException(
+ "Unable to add file to bundle jar file: "
+ + artifact.getFile().getAbsolutePath(), e);
+ }
+ }
+ }
+ }
+
+ private void addResources(Resource resource) throws MojoExecutionException {
+ getLog().info(
+ String.format("Adding resources [%s] to [%s]", resource
+ .getDirectory(), resource.getTargetPath()));
+ String[] fileNames = getFilesToCopy(resource);
+ for (int i = 0; i < fileNames.length; i++) {
+ String targetFileName = fileNames[i];
+ if (resource.getTargetPath() != null) {
+ targetFileName = resource.getTargetPath() + File.separator
+ + targetFileName;
+ }
+
+ try {
+ jarArchiver.addFile(new File(resource.getDirectory(),
+ fileNames[i]), targetFileName);
+ } catch (ArchiverException e) {
+ throw new MojoExecutionException(
+ "Unable to add resources to JAR file", e);
+ }
+
+ }
+ }
+
+ private File createJARFile() throws MojoExecutionException {
+ File jarFile = new File(outputDirectory, jarName + "-" + CLASSIFIER
+ + "." + JAR);
+ jarArchiver.setDestFile(jarFile);
+
+ addBundles();
+ addResources();
+
+ try {
+ jarArchiver.createArchive();
+ } catch (ArchiverException e) {
+ throw new MojoExecutionException(
+ "Unable to create bundle jar file", e);
+ } catch (IOException e) {
+ throw new MojoExecutionException(
+ "Unable to create bundle jar file", e);
+ }
+
+ return jarFile;
+ }
+
+ private void addResources() throws MojoExecutionException {
+ if (resources != null) {
+ for (Resource resource : resources) {
+ if (!(new File(resource.getDirectory())).isAbsolute()) {
+ resource.setDirectory(project.getBasedir() + File.separator
+ + resource.getDirectory());
+ }
+ addResources(resource);
+ }
+ }
+ }
+
+ @Override
+ protected void executeWithArtifacts() throws MojoExecutionException,
+ MojoFailureException {
+ File jarFile = createJARFile();
+ projectHelper.attachArtifact(project, JAR, CLASSIFIER, jarFile);
+ }
+
+ /**
+ * Returns a list of filenames that should be copied over to the destination
+ * directory.
+ *
+ * @param resource
+ * the resource to be scanned
+ * @return the array of filenames, relative to the sourceDir
+ */
+ @SuppressWarnings("unchecked")
private static String[] getFilesToCopy(Resource resource) {
- DirectoryScanner scanner = new DirectoryScanner();
- scanner.setBasedir(resource.getDirectory());
- if (resource.getIncludes() != null && !resource.getIncludes().isEmpty()) {
- scanner.setIncludes((String[]) resource.getIncludes().toArray(
- new String[resource.getIncludes().size()]));
- } else {
- scanner.setIncludes(DEFAULT_INCLUDES);
- }
- if (resource.getExcludes() != null && !resource.getExcludes().isEmpty()) {
- scanner.setExcludes((String[]) resource.getExcludes().toArray(
- new String[resource.getExcludes().size()]));
- }
-
- scanner.addDefaultExcludes();
-
- scanner.scan();
-
- return scanner.getIncludedFiles();
- }
+ DirectoryScanner scanner = new DirectoryScanner();
+ scanner.setBasedir(resource.getDirectory());
+ if (resource.getIncludes() != null && !resource.getIncludes().isEmpty()) {
+ scanner.setIncludes((String[]) resource.getIncludes().toArray(
+ new String[resource.getIncludes().size()]));
+ } else {
+ scanner.setIncludes(DEFAULT_INCLUDES);
+ }
+ if (resource.getExcludes() != null && !resource.getExcludes().isEmpty()) {
+ scanner.setExcludes((String[]) resource.getExcludes().toArray(
+ new String[resource.getExcludes().size()]));
+ }
+
+ scanner.addDefaultExcludes();
+
+ scanner.scan();
+
+ return scanner.getIncludedFiles();
+ }
}
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/CreateKarafFeatureDescriptorMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/CreateKarafFeatureDescriptorMojo.java
index dba8b69..f66b60b 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/CreateKarafFeatureDescriptorMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/CreateKarafFeatureDescriptorMojo.java
@@ -78,7 +78,7 @@ public class CreateKarafFeatureDescriptorMojo extends AbstractUsingBundleListMoj
feature.setAttribute("name", featureName);
feature.setAttribute("version", featureVersion);
- BundleList bundleList = getBundleList();
+ BundleList bundleList = getInitializedBundleList();
for (StartLevel level : bundleList.getStartLevels()) {
for (Bundle bundle : level.getBundles()) {
String bundleRef = String.format("mvn:%s/%s/%s", bundle.getGroupId(), bundle.getArtifactId(), bundle
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/OutputBundleListMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/OutputBundleListMojo.java
index 9c8cec1..a1e5b67 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/OutputBundleListMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/OutputBundleListMojo.java
@@ -35,7 +35,7 @@ public class OutputBundleListMojo extends AbstractUsingBundleListMojo {
protected void executeWithArtifacts() throws MojoExecutionException, MojoFailureException {
BundleListXpp3Writer writer = new BundleListXpp3Writer();
try {
- writer.write(new OutputStreamWriter(System.out), getBundleList());
+ writer.write(new OutputStreamWriter(System.out), getInitializedBundleList());
} catch (IOException e) {
throw new MojoExecutionException("Unable to write bundle list", e);
}
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java
index abc2f03..378857c 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java
@@ -46,44 +46,44 @@ import org.codehaus.plexus.util.FileUtils;
*/
public class PreparePackageMojo extends AbstractLaunchpadFrameworkMojo {
- /**
- * The output directory for the default bundles in a WAR-packaged project,
- * the base JAR (in the subdirectory named in the baseDestination
- * parameter), and any additional bundles.
- *
- * @parameter default-value="${project.build.directory}/launchpad-bundles"
- */
- private File warOutputDirectory;
-
- /**
- * The project's packaging type.
- *
- * @parameter expression="${project.packaging}"
- */
- private String packaging;
-
- /**
- * The definition of the base JAR.
- *
- * @parameter
- */
- private ArtifactDefinition base;
-
- /**
- * The definition of the package to be included to provide web support for
- * JAR-packaged projects (i.e. pax-web).
- *
- * @parameter
- */
- private ArtifactDefinition jarWebSupport;
-
- /**
- * The project's build output directory (i.e. target/classes).
- *
- * @parameter expression="${project.build.outputDirectory}"
- * @readonly
- */
- private File buildOutputDirectory;
+ /**
+ * The output directory for the default bundles in a WAR-packaged project,
+ * the base JAR (in the subdirectory named in the baseDestination
+ * parameter), and any additional bundles.
+ *
+ * @parameter default-value="${project.build.directory}/launchpad-bundles"
+ */
+ private File warOutputDirectory;
+
+ /**
+ * The project's packaging type.
+ *
+ * @parameter expression="${project.packaging}"
+ */
+ private String packaging;
+
+ /**
+ * The definition of the base JAR.
+ *
+ * @parameter
+ */
+ private ArtifactDefinition base;
+
+ /**
+ * The definition of the package to be included to provide web support for
+ * JAR-packaged projects (i.e. pax-web).
+ *
+ * @parameter
+ */
+ private ArtifactDefinition jarWebSupport;
+
+ /**
+ * The project's build output directory (i.e. target/classes).
+ *
+ * @parameter expression="${project.build.outputDirectory}"
+ * @readonly
+ */
+ private File buildOutputDirectory;
/**
* The temp directory (i.e. target/maven-launchpad-plugintmp).
@@ -108,27 +108,27 @@ public class PreparePackageMojo extends AbstractLaunchpadFrameworkMojo {
private JarArchiver jarArchiver;
public void executeWithArtifacts() throws MojoExecutionException, MojoFailureException {
- copyBaseArtifact();
- copyBundles(getBundleList(), getOutputDirectory());
- copyConfigurationFiles();
- if (JAR.equals(packaging)) {
- unpackBaseArtifact();
- }
- }
+ copyBaseArtifact();
+ copyBundles(getInitializedBundleList(), getOutputDirectory());
+ copyConfigurationFiles();
+ if (JAR.equals(packaging)) {
+ unpackBaseArtifact();
+ }
+ }
protected void initArtifactDefinitions(Properties dependencies) {
- if (base == null) {
- base = new ArtifactDefinition();
- }
- base.initDefaults(dependencies.getProperty("base"));
-
- if (jarWebSupport == null) {
- jarWebSupport = new ArtifactDefinition();
- }
- jarWebSupport.initDefaults(dependencies.getProperty("jarWebSupport"));
- }
-
- /**
+ if (base == null) {
+ base = new ArtifactDefinition();
+ }
+ base.initDefaults(dependencies.getProperty("base"));
+
+ if (jarWebSupport == null) {
+ jarWebSupport = new ArtifactDefinition();
+ }
+ jarWebSupport.initDefaults(dependencies.getProperty("jarWebSupport"));
+ }
+
+ /**
* Add the JAR Web Support bundle to the bundle list.
*/
@Override
@@ -210,96 +210,96 @@ public class PreparePackageMojo extends AbstractLaunchpadFrameworkMojo {
}
private void copyBaseArtifact() throws MojoExecutionException {
- Artifact artifact = getBaseArtifact();
- if (artifact == null) {
- throw new MojoExecutionException(
- String.format("Project doesn't have a base dependency of groupId %s and artifactId %s",
- base.getGroupId(), base.getArtifactId()));
- }
- File destinationDir = new File(getOutputDirectory(), baseDestination);
- File destinationFile = new File(destinationDir, artifact
- .getArtifactId()
- + "." + artifact.getArtifactHandler().getExtension());
-
- // check if custom sling.properties file or bootstrap command exists
- final Properties additionalProps = this.getSlingProperties(JAR.equals(this.packaging));
- final String bootstrapCmd = this.getSlingBootstrap(JAR.equals(this.packaging));
- if ( additionalProps != null || bootstrapCmd != null ) {
- // unpack to a temp destination
- final File dest = new File(this.tempDirectory, "basejar");
- try {
- unpack(artifact.getFile(), dest);
-
- // patch sling properties
- if ( additionalProps != null ) {
- this.patchSlingProperties(dest, additionalProps);
- }
-
- // patch bootstrap command
+ Artifact artifact = getBaseArtifact();
+ if (artifact == null) {
+ throw new MojoExecutionException(
+ String.format("Project doesn't have a base dependency of groupId %s and artifactId %s",
+ base.getGroupId(), base.getArtifactId()));
+ }
+ File destinationDir = new File(getOutputDirectory(), baseDestination);
+ File destinationFile = new File(destinationDir, artifact
+ .getArtifactId()
+ + "." + artifact.getArtifactHandler().getExtension());
+
+ // check if custom sling.properties file or bootstrap command exists
+ final Properties additionalProps = this.getSlingProperties(JAR.equals(this.packaging));
+ final String bootstrapCmd = this.getSlingBootstrap(JAR.equals(this.packaging));
+ if ( additionalProps != null || bootstrapCmd != null ) {
+ // unpack to a temp destination
+ final File dest = new File(this.tempDirectory, "basejar");
+ try {
+ unpack(artifact.getFile(), dest);
+
+ // patch sling properties
+ if ( additionalProps != null ) {
+ this.patchSlingProperties(dest, additionalProps);
+ }
+
+ // patch bootstrap command
if ( bootstrapCmd != null ) {
this.patchSlingBootstrap(dest, bootstrapCmd);
}
// and repack again
- pack(dest, destinationFile);
- } finally {
- this.tempDirectory.delete();
- }
- } else {
- // we can just copy
- if (shouldCopy(artifact.getFile(), destinationFile)) {
- try {
- getLog().info(
- String.format("Copying base artifact from %s to %s.",
- artifact.getFile(), destinationFile));
- FileUtils.copyFile(artifact.getFile(), destinationFile);
- } catch (IOException e) {
- throw new MojoExecutionException(
- "Unable to copy base artifact.", e);
- }
- } else {
- getLog().debug(
- String.format("Skipping copy of base artifact from %s.",
- artifact.getFile()));
- }
- }
- }
-
- private Artifact getBaseArtifact() throws MojoExecutionException {
- Artifact baseDependency = getBaseDependency();
- if (baseDependency == null) {
- return null;
- }
-
- return getArtifact(base.getGroupId(), base.getArtifactId(),
- baseDependency.getVersion(), base.getType(), base
- .getClassifier());
-
- }
-
- private Artifact getBaseDependency() {
- return (Artifact) project.getArtifactMap().get(
- base.getGroupId() + ":" + base.getArtifactId());
- }
-
- protected File getOutputDirectory() {
- if (WAR.equals(packaging)) {
- return warOutputDirectory;
+ pack(dest, destinationFile);
+ } finally {
+ this.tempDirectory.delete();
+ }
+ } else {
+ // we can just copy
+ if (shouldCopy(artifact.getFile(), destinationFile)) {
+ try {
+ getLog().info(
+ String.format("Copying base artifact from %s to %s.",
+ artifact.getFile(), destinationFile));
+ FileUtils.copyFile(artifact.getFile(), destinationFile);
+ } catch (IOException e) {
+ throw new MojoExecutionException(
+ "Unable to copy base artifact.", e);
+ }
+ } else {
+ getLog().debug(
+ String.format("Skipping copy of base artifact from %s.",
+ artifact.getFile()));
+ }
+ }
+ }
+
+ private Artifact getBaseArtifact() throws MojoExecutionException {
+ Artifact baseDependency = getBaseDependency();
+ if (baseDependency == null) {
+ return null;
+ }
+
+ return getArtifact(base.getGroupId(), base.getArtifactId(),
+ baseDependency.getVersion(), base.getType(), base
+ .getClassifier());
+
+ }
+
+ private Artifact getBaseDependency() {
+ return (Artifact) project.getArtifactMap().get(
+ base.getGroupId() + ":" + base.getArtifactId());
+ }
+
+ protected File getOutputDirectory() {
+ if (WAR.equals(packaging)) {
+ return warOutputDirectory;
+ }
+ return buildOutputDirectory;
+ }
+
+ protected void unpackBaseArtifact() throws MojoExecutionException {
+ Artifact artifact = getBaseDependency();
+ if (artifact == null) {
+ throw new MojoExecutionException(
+ String
+ .format(
+ "Project doesn't have a base dependency of groupId %s and artifactId %s",
+ base.getGroupId(), base.getArtifactId()));
}
- return buildOutputDirectory;
- }
-
- protected void unpackBaseArtifact() throws MojoExecutionException {
- Artifact artifact = getBaseDependency();
- if (artifact == null) {
- throw new MojoExecutionException(
- String
- .format(
- "Project doesn't have a base dependency of groupId %s and artifactId %s",
- base.getGroupId(), base.getArtifactId()));
- }
- unpack(artifact.getFile(), buildOutputDirectory);
- }
+ unpack(artifact.getFile(), buildOutputDirectory);
+ }
private void copyConfigurationFiles() throws MojoExecutionException {
try {
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/ValidateBundleListMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/ValidateBundleListMojo.java
index 4cdd931..bb12d9d 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/ValidateBundleListMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/ValidateBundleListMojo.java
@@ -36,24 +36,24 @@ import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
public class ValidateBundleListMojo extends AbstractBundleListMojo {
public void execute() throws MojoExecutionException, MojoFailureException {
- final BundleList bundleList;
+ final BundleList initializedBundleList;
if (bundleListFile.exists()) {
try {
- bundleList = readBundleList(bundleListFile);
+ initializedBundleList = readBundleList(bundleListFile);
} catch (IOException e) {
throw new MojoExecutionException("Unable to read bundle list file", e);
} catch (XmlPullParserException e) {
throw new MojoExecutionException("Unable to read bundle list file", e);
}
} else {
- bundleList = new BundleList();
+ initializedBundleList = new BundleList();
}
- addDependencies(bundleList);
+ addDependencies(initializedBundleList);
- interpolateProperties(bundleList);
+ interpolateProperties(initializedBundleList);
- for (StartLevel sl : bundleList.getStartLevels()) {
+ for (StartLevel sl : initializedBundleList.getStartLevels()) {
for (Bundle bundle : sl.getBundles()) {
getArtifact(new ArtifactDefinition(bundle, -1));
}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.