From 73410a244dd371018ba120af62382af21c38997c Mon Sep 17 00:00:00 2001 From: Wouter Bancken Date: Wed, 4 Jan 2017 15:16:17 +0100 Subject: [PATCH 1/7] ARIES-1650 Optionally exclude non bundle artifacts in ESA maven plugin --- esa-maven-plugin/pom.xml | 5 ++ .../org/apache/aries/plugin/esa/EsaMojo.java | 63 ++++++++++++++---- .../apache/aries/plugin/esa/EsaMojoTest.java | 50 +++++++++++++- .../esa/stubs/EsaMavenProjectStub10.java | 41 ++++++++++++ ...fact05-no-bundle-manifest-1.1-SNAPSHOT.jar | Bin 0 -> 327 bytes ...fact05-no-bundle-manifest-1.1-SNAPSHOT.pom | 25 +++++++ .../plugin-config.xml | 1 + .../basic-esa-content-type/plugin-config.xml | 1 + .../plugin-config.xml | 1 + .../plugin-config.xml | 46 +++++++++++++ .../basic-esa-no-bundles/plugin-config.xml | 1 + .../basic-esa-start-order/plugin-config.xml | 1 + .../plugin-config.xml | 1 + .../unit/basic-esa-test/plugin-config.xml | 1 + .../plugin-config.xml | 1 + .../basic-esa-with-manifest/plugin-config.xml | 1 + .../plugin-config.xml | 1 + 17 files changed, 225 insertions(+), 15 deletions(-) create mode 100644 esa-maven-plugin/src/test/java/org/apache/aries/plugin/esa/stubs/EsaMavenProjectStub10.java create mode 100644 esa-maven-plugin/src/test/remote-repo/org/apache/maven/test/maven-artifact05-no-bundle-manifest/1.1-SNAPSHOT/maven-artifact05-no-bundle-manifest-1.1-SNAPSHOT.jar create mode 100644 esa-maven-plugin/src/test/remote-repo/org/apache/maven/test/maven-artifact05-no-bundle-manifest/1.1-SNAPSHOT/maven-artifact05-no-bundle-manifest-1.1-SNAPSHOT.pom create mode 100644 esa-maven-plugin/src/test/resources/unit/basic-esa-exclude-non-bundle-jars/plugin-config.xml diff --git a/esa-maven-plugin/pom.xml b/esa-maven-plugin/pom.xml index d9480a45d4..dde3478835 100644 --- a/esa-maven-plugin/pom.xml +++ b/esa-maven-plugin/pom.xml @@ -42,6 +42,11 @@ + + org.apache.aries + org.apache.aries.util + 1.1.3 + biz.aQute bndlib diff --git a/esa-maven-plugin/src/main/java/org/apache/aries/plugin/esa/EsaMojo.java b/esa-maven-plugin/src/main/java/org/apache/aries/plugin/esa/EsaMojo.java index 4fb9a73a36..9882faa5b2 100644 --- a/esa-maven-plugin/src/main/java/org/apache/aries/plugin/esa/EsaMojo.java +++ b/esa-maven-plugin/src/main/java/org/apache/aries/plugin/esa/EsaMojo.java @@ -19,6 +19,18 @@ * under the License. */ +import static org.apache.aries.util.manifest.BundleManifest.fromBundle; + +import java.io.File; +import java.io.IOException; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.Map; +import java.util.Set; + +import org.apache.aries.util.manifest.BundleManifest; import org.apache.maven.archiver.PomPropertiesUtil; import org.apache.maven.artifact.Artifact; import org.apache.maven.plugin.AbstractMojo; @@ -28,14 +40,6 @@ import org.codehaus.plexus.archiver.zip.ZipArchiver; import org.codehaus.plexus.util.DirectoryScanner; import org.codehaus.plexus.util.FileUtils; -import java.io.File; -import java.io.IOException; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; /** * Builds OSGi Enterprise Subsystem Archive (esa) files. @@ -183,6 +187,13 @@ public enum EsaContent {none, all, content}; */ private String archiveContent; + /** + * Whether non-bundle JAR files should be included in the archive + * + * @parameter expression="${includeNonBundleJars}" default-value="true" + */ + private boolean includeNonBundleJars; + /** * Define the start order for content bundles. * none - no start orders are added @@ -227,7 +238,10 @@ private void addDependenciesToArchive() throws MojoExecutionException { artifacts.add(project.getArtifact()); } - artifacts = selectArtifacts(artifacts); + artifacts = selectArtifactsInCompileOrRuntimeScope(artifacts); + if(!includeNonBundleJars){ + artifacts = selectNonJarArtifactsAndBundles(artifacts); + } int cnt = 0; for (Artifact artifact : artifacts) { if (!artifact.isOptional() /*&& filter.include(artifact)*/) { @@ -410,8 +424,8 @@ private void writeSubsystemManifest(String fileName) Set artifacts = null; // only include the direct dependencies in the content artifacts = project.getDependencyArtifacts(); - - artifacts = selectArtifacts(artifacts); + + artifacts = selectArtifactsInCompileOrRuntimeScope(artifacts); Iterator iter = artifacts.iterator(); FileUtils.fileAppend(fileName, Constants.SUBSYSTEM_CONTENT + ": "); @@ -517,9 +531,9 @@ private void includeCustomSubsystemManifestFile() } /** - * Return artifacts in 'compile' or 'runtime' scope only. + * Returns artifacts in 'compile' or 'runtime' scope only. */ - private Set selectArtifacts(Set artifacts) + private Set selectArtifactsInCompileOrRuntimeScope(Set artifacts) { Set selected = new LinkedHashSet(); for (Artifact artifact : artifacts) { @@ -533,6 +547,29 @@ private Set selectArtifacts(Set artifacts) return selected; } + /** + * Returns bundles and artifacts that aren't JARs + */ + private Set selectNonJarArtifactsAndBundles(Set artifacts) + { + Set selected = new LinkedHashSet(); + for (Artifact artifact : artifacts) { + if (isNonJarOrOSGiBundle(artifact)) { + selected.add(artifact); + } + } + return selected; + } + + private boolean isNonJarOrOSGiBundle(Artifact artifact) { + if(!artifact.getFile().getName().endsWith(".jar")){ + return true; + } else { + BundleManifest manifest = fromBundle(artifact.getFile()); + return manifest != null && manifest.getSymbolicName() != null; + } + } + private void includeSharedResources() throws MojoExecutionException { try { diff --git a/esa-maven-plugin/src/test/java/org/apache/aries/plugin/esa/EsaMojoTest.java b/esa-maven-plugin/src/test/java/org/apache/aries/plugin/esa/EsaMojoTest.java index 79e576c401..177c3bff8a 100644 --- a/esa-maven-plugin/src/test/java/org/apache/aries/plugin/esa/EsaMojoTest.java +++ b/esa-maven-plugin/src/test/java/org/apache/aries/plugin/esa/EsaMojoTest.java @@ -30,12 +30,12 @@ import java.util.jar.Attributes; import java.util.jar.Manifest; -import aQute.lib.osgi.Analyzer; - import org.apache.maven.plugin.testing.AbstractMojoTestCase; import org.codehaus.plexus.archiver.zip.ZipEntry; import org.codehaus.plexus.archiver.zip.ZipFile; +import aQute.lib.osgi.Analyzer; + /** * @author Allan Ramirez */ @@ -414,6 +414,52 @@ public void testArchiveContentConfigurationNoBundles() } + public void testBasicEsaWithoutNonBundleJars() + throws Exception + { + File testPom = new File( getBasedir(), + "target/test-classes/unit/basic-esa-exclude-non-bundle-jars/plugin-config.xml" ); + + EsaMojo mojo = ( EsaMojo ) lookupMojo( "esa", testPom ); + + assertNotNull( mojo ); + + String finalName = ( String ) getVariableValueFromObject( mojo, "finalName" ); + + String workDir = ( String ) getVariableValueFromObject( mojo, "workDirectory" ); + + String outputDir = ( String ) getVariableValueFromObject( mojo, "outputDirectory" ); + + mojo.execute(); + + //check the generated esa file + File esaFile = new File( outputDir, finalName + ".esa" ); + + assertTrue( esaFile.exists() ); + + //expected files/directories inside the esa file + List expectedFiles = new ArrayList(); + + expectedFiles.add( "maven-artifact01-1.0-SNAPSHOT.jar" ); + expectedFiles.add( "META-INF/maven/org.apache.maven.test/maven-esa-test/pom.properties" ); + expectedFiles.add( "META-INF/maven/org.apache.maven.test/maven-esa-test/pom.xml" ); + expectedFiles.add( "META-INF/maven/org.apache.maven.test/maven-esa-test/" ); + expectedFiles.add( "META-INF/maven/org.apache.maven.test/" ); + expectedFiles.add( "META-INF/maven/" ); + expectedFiles.add( "META-INF/" ); + expectedFiles.add( "OSGI-INF/SUBSYSTEM.MF" ); + expectedFiles.add( "OSGI-INF/" ); + + ZipFile esa = new ZipFile( esaFile ); + + Enumeration entries = esa.getEntries(); + + assertTrue( entries.hasMoreElements() ); + + int missing = getSizeOfExpectedFiles(entries, expectedFiles); + assertEquals("Missing files: " + expectedFiles, 0, missing); + } + public void testArchiveContentConfigurationSubsystemContentBundles() throws Exception { diff --git a/esa-maven-plugin/src/test/java/org/apache/aries/plugin/esa/stubs/EsaMavenProjectStub10.java b/esa-maven-plugin/src/test/java/org/apache/aries/plugin/esa/stubs/EsaMavenProjectStub10.java new file mode 100644 index 0000000000..5620652afb --- /dev/null +++ b/esa-maven-plugin/src/test/java/org/apache/aries/plugin/esa/stubs/EsaMavenProjectStub10.java @@ -0,0 +1,41 @@ +package org.apache.aries.plugin.esa.stubs; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; +import java.util.HashSet; +import java.util.Set; + +public class EsaMavenProjectStub10 + extends EsaMavenProjectStub +{ + public File getFile() + { + return new File( getBasedir(), "src/test/resources/unit/basic-esa-exclude-non-bundle-jars/plugin-config.xml" ); + } + + public Set getArtifacts() + { + Set artifacts = new HashSet(); + artifacts.add( createArtifact( "org.apache.maven.test", "maven-artifact01", "1.0-SNAPSHOT", false ) ); + artifacts.add( createArtifact( "org.apache.maven.test", "maven-artifact05-no-bundle-manifest", "1.1-SNAPSHOT", false )); + return artifacts; + } +} diff --git a/esa-maven-plugin/src/test/remote-repo/org/apache/maven/test/maven-artifact05-no-bundle-manifest/1.1-SNAPSHOT/maven-artifact05-no-bundle-manifest-1.1-SNAPSHOT.jar b/esa-maven-plugin/src/test/remote-repo/org/apache/maven/test/maven-artifact05-no-bundle-manifest/1.1-SNAPSHOT/maven-artifact05-no-bundle-manifest-1.1-SNAPSHOT.jar new file mode 100644 index 0000000000000000000000000000000000000000..988d49a5b135ebb0f292d6fbe538352d5c40036a GIT binary patch literal 327 zcmWIWW@h1H0D+ehGhM(8D8b1fz~Ji|;;8HC=cXST!NcITH8L24zcPw21OT;(FmM2& zb%lx-vNjQ9ZN83vo^GzeA$q=UAQNI3awCF(7-Yg{-!rFuymj?1@_OrPojY@WbCAIm zV+NqX>>QCh4Xnh0W{LuFfHxzPC^Ie>^1y6%c + + + 4.0.0 + org.apache.maven.test + maven-artifact05-no-bundle-manifest + 1.1-SNAPSHOT + diff --git a/esa-maven-plugin/src/test/resources/unit/basic-esa-content-bundles-only/plugin-config.xml b/esa-maven-plugin/src/test/resources/unit/basic-esa-content-bundles-only/plugin-config.xml index 4c7fac0094..5f71bf30f6 100644 --- a/esa-maven-plugin/src/test/resources/unit/basic-esa-content-bundles-only/plugin-config.xml +++ b/esa-maven-plugin/src/test/resources/unit/basic-esa-content-bundles-only/plugin-config.xml @@ -22,6 +22,7 @@ true true + true ${basedir}/target/unit/basic-esa-content-bundles-only/target/esa-test-content-bundles-only ${basedir}/target/unit/basic-esa-content-bundles-only/target/maven-shared-archive-resources diff --git a/esa-maven-plugin/src/test/resources/unit/basic-esa-content-type/plugin-config.xml b/esa-maven-plugin/src/test/resources/unit/basic-esa-content-type/plugin-config.xml index 9de241f923..c0054e8d04 100644 --- a/esa-maven-plugin/src/test/resources/unit/basic-esa-content-type/plugin-config.xml +++ b/esa-maven-plugin/src/test/resources/unit/basic-esa-content-type/plugin-config.xml @@ -19,6 +19,7 @@ true false true + true ${basedir}/target/unit/basic-esa-content-type/target/esa-test-content-type ${basedir}/target/unit/basic-esa-content-type/target/maven-shared-archive-resources diff --git a/esa-maven-plugin/src/test/resources/unit/basic-esa-custom-instructions/plugin-config.xml b/esa-maven-plugin/src/test/resources/unit/basic-esa-custom-instructions/plugin-config.xml index 82ecbc2c00..350f614f14 100644 --- a/esa-maven-plugin/src/test/resources/unit/basic-esa-custom-instructions/plugin-config.xml +++ b/esa-maven-plugin/src/test/resources/unit/basic-esa-custom-instructions/plugin-config.xml @@ -33,6 +33,7 @@ under the License. false true + true ${basedir}/target/unit/basic-esa-custom-instructions/target/esa-test-custom-instructions ${basedir}/target/unit/basic-esa-custom-instructions/target/maven-shared-archive-resources ${basedir}/target/unit/basic-esa-custom-instructions/target diff --git a/esa-maven-plugin/src/test/resources/unit/basic-esa-exclude-non-bundle-jars/plugin-config.xml b/esa-maven-plugin/src/test/resources/unit/basic-esa-exclude-non-bundle-jars/plugin-config.xml new file mode 100644 index 0000000000..2244a152e7 --- /dev/null +++ b/esa-maven-plugin/src/test/resources/unit/basic-esa-exclude-non-bundle-jars/plugin-config.xml @@ -0,0 +1,46 @@ + + + + + + + esa-maven-plugin + + ${basedir}/src/test/resources/unit/basic-esa-exclude-non-bundle-jars/src/main/esa + true + all + + + true + true + false + ${basedir}/target/unit/basic-esa-exclude-non-bundle-jars/target/basic-esa-exclude-non-bundle-jars + + ${basedir}/target/unit/basic-esa-exclude-non-bundle-jars/target/maven-shared-archive-resources + + ${basedir}/target/unit/basic-esa-exclude-non-bundle-jars/target + + test-esa-exclude-non-bundle-jars + + + + + + diff --git a/esa-maven-plugin/src/test/resources/unit/basic-esa-no-bundles/plugin-config.xml b/esa-maven-plugin/src/test/resources/unit/basic-esa-no-bundles/plugin-config.xml index 5ca01e800e..3fbd57ea95 100644 --- a/esa-maven-plugin/src/test/resources/unit/basic-esa-no-bundles/plugin-config.xml +++ b/esa-maven-plugin/src/test/resources/unit/basic-esa-no-bundles/plugin-config.xml @@ -22,6 +22,7 @@ true true + true ${basedir}/target/unit/basic-esa-no-bundles/target/esa-test-no-bundles ${basedir}/target/unit/basic-esa-no-bundles/target/maven-shared-archive-resources diff --git a/esa-maven-plugin/src/test/resources/unit/basic-esa-start-order/plugin-config.xml b/esa-maven-plugin/src/test/resources/unit/basic-esa-start-order/plugin-config.xml index e06ce1a574..55fb1950bf 100644 --- a/esa-maven-plugin/src/test/resources/unit/basic-esa-start-order/plugin-config.xml +++ b/esa-maven-plugin/src/test/resources/unit/basic-esa-start-order/plugin-config.xml @@ -29,6 +29,7 @@ under the License. true + true ${basedir}/target/unit/basic-esa-start-order/target/esa-test-start-order ${basedir}/target/unit/basic-esa-start-order/target/maven-shared-archive-resources ${basedir}/target/unit/basic-esa-start-order/target diff --git a/esa-maven-plugin/src/test/resources/unit/basic-esa-test-with-pgk-type/plugin-config.xml b/esa-maven-plugin/src/test/resources/unit/basic-esa-test-with-pgk-type/plugin-config.xml index e4da77c0fd..5f0cf51d61 100644 --- a/esa-maven-plugin/src/test/resources/unit/basic-esa-test-with-pgk-type/plugin-config.xml +++ b/esa-maven-plugin/src/test/resources/unit/basic-esa-test-with-pgk-type/plugin-config.xml @@ -27,6 +27,7 @@ under the License. ${basedir}/src/test/resources/unit/basic-esa-test-with-pgk-type/src/main/esa/OSGI-INF/SUBSYSTEM.MF true true + true ${basedir}/src/main/esa/META-INF/MANIFEST.MF ${basedir}/target/unit/basic-esa-test-with-pgk-type/target/esa-test ${basedir}/target/unit/basic-esa-test-with-pgk-type/target/maven-shared-archive-resources diff --git a/esa-maven-plugin/src/test/resources/unit/basic-esa-test/plugin-config.xml b/esa-maven-plugin/src/test/resources/unit/basic-esa-test/plugin-config.xml index 48d662e791..2b363f1702 100644 --- a/esa-maven-plugin/src/test/resources/unit/basic-esa-test/plugin-config.xml +++ b/esa-maven-plugin/src/test/resources/unit/basic-esa-test/plugin-config.xml @@ -27,6 +27,7 @@ under the License. ${basedir}/src/test/resources/unit/basic-esa-test/src/main/esa/OSGI-INF/SUBSYSTEM.MF true true + true ${basedir}/src/main/esa/META-INF/MANIFEST.MF ${basedir}/target/unit/basic-esa-test/target/esa-test ${basedir}/target/unit/basic-esa-test/target/maven-shared-archive-resources diff --git a/esa-maven-plugin/src/test/resources/unit/basic-esa-with-descriptor/plugin-config.xml b/esa-maven-plugin/src/test/resources/unit/basic-esa-with-descriptor/plugin-config.xml index 14c11419da..bec4060c69 100644 --- a/esa-maven-plugin/src/test/resources/unit/basic-esa-with-descriptor/plugin-config.xml +++ b/esa-maven-plugin/src/test/resources/unit/basic-esa-with-descriptor/plugin-config.xml @@ -27,6 +27,7 @@ under the License. ${basedir}/src/test/resources/unit/basic-esa-with-descriptor/src/main/esa/OSGI-INF/SUBSYSTEM.MF true true + true ${basedir}/src/test/resources/unit/basic-esa-with-descriptor/src/main/esa/META-INF/MANIFEST.MF ${basedir}/target/unit/basic-esa-with-descriptor/target/esa-test-with-descriptor ${basedir}/target/unit/basic-esa-with-descriptor/target/maven-shared-archive-resources diff --git a/esa-maven-plugin/src/test/resources/unit/basic-esa-with-manifest/plugin-config.xml b/esa-maven-plugin/src/test/resources/unit/basic-esa-with-manifest/plugin-config.xml index c3326ddcbc..98cc8aa6b7 100644 --- a/esa-maven-plugin/src/test/resources/unit/basic-esa-with-manifest/plugin-config.xml +++ b/esa-maven-plugin/src/test/resources/unit/basic-esa-with-manifest/plugin-config.xml @@ -27,6 +27,7 @@ under the License. ${basedir}/src/test/resources/unit/basic-esa-with-manifest/src/main/esa/OSGI-INF/SUBSYSTEM.MF true true + true ${basedir}/src/test/resources/unit/basic-esa-with-manifest/src/main/esa/META-INF/MANIFEST.MF ${basedir}/target/unit/basic-esa-with-manifest/target/esa-test-with-manifest ${basedir}/target/unit/basic-esa-with-manifest/target/maven-shared-archive-resources diff --git a/esa-maven-plugin/src/test/resources/unit/basic-esa-without-manifest/plugin-config.xml b/esa-maven-plugin/src/test/resources/unit/basic-esa-without-manifest/plugin-config.xml index 8417f6656b..8310f2aceb 100644 --- a/esa-maven-plugin/src/test/resources/unit/basic-esa-without-manifest/plugin-config.xml +++ b/esa-maven-plugin/src/test/resources/unit/basic-esa-without-manifest/plugin-config.xml @@ -31,6 +31,7 @@ under the License. true true + true ${basedir}/target/unit/basic-esa-without-manifest/target/esa-test-without-manifest ${basedir}/target/unit/basic-esa-without-manifest/target/maven-shared-archive-resources ${basedir}/target/unit/basic-esa-without-manifest/target From 917c25917e9fa7a92a75233c82a147e764a912cd Mon Sep 17 00:00:00 2001 From: Wouter Bancken Date: Wed, 4 Jan 2017 15:28:02 +0100 Subject: [PATCH 2/7] ARIES-1650 also select when parsing manifest --- .../src/main/java/org/apache/aries/plugin/esa/EsaMojo.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/esa-maven-plugin/src/main/java/org/apache/aries/plugin/esa/EsaMojo.java b/esa-maven-plugin/src/main/java/org/apache/aries/plugin/esa/EsaMojo.java index 9882faa5b2..2171c0960c 100644 --- a/esa-maven-plugin/src/main/java/org/apache/aries/plugin/esa/EsaMojo.java +++ b/esa-maven-plugin/src/main/java/org/apache/aries/plugin/esa/EsaMojo.java @@ -419,13 +419,15 @@ private void writeSubsystemManifest(String fileName) } // Write the SUBSYSTEM-CONTENT - // TODO: check that the dependencies are bundles (currently, the converter - // will throw an exception) Set artifacts = null; // only include the direct dependencies in the content artifacts = project.getDependencyArtifacts(); artifacts = selectArtifactsInCompileOrRuntimeScope(artifacts); + if(!includeNonBundleJars){ + artifacts = selectNonJarArtifactsAndBundles(artifacts); + } + Iterator iter = artifacts.iterator(); FileUtils.fileAppend(fileName, Constants.SUBSYSTEM_CONTENT + ": "); From 2a6c7a619fd44f13a38a0340a42265eda90c4e7b Mon Sep 17 00:00:00 2001 From: Wouter Bancken Date: Wed, 4 Jan 2017 15:33:31 +0100 Subject: [PATCH 3/7] ARIES-1650 add warn level logging for non bundle jars --- .../src/main/java/org/apache/aries/plugin/esa/EsaMojo.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/esa-maven-plugin/src/main/java/org/apache/aries/plugin/esa/EsaMojo.java b/esa-maven-plugin/src/main/java/org/apache/aries/plugin/esa/EsaMojo.java index 2171c0960c..676e845867 100644 --- a/esa-maven-plugin/src/main/java/org/apache/aries/plugin/esa/EsaMojo.java +++ b/esa-maven-plugin/src/main/java/org/apache/aries/plugin/esa/EsaMojo.java @@ -558,6 +558,8 @@ private Set selectNonJarArtifactsAndBundles(Set artifacts) for (Artifact artifact : artifacts) { if (isNonJarOrOSGiBundle(artifact)) { selected.add(artifact); + } else { + getLog().warn("Found dependency on non-bundle JAR! groupId: " + artifact.getGroupId() + " artifactId:" + artifact.getArtifactId()); } } return selected; From 93bc2658dad3b24877a3c5294382302dc271f70b Mon Sep 17 00:00:00 2001 From: Wouter Bancken Date: Wed, 4 Jan 2017 15:53:25 +0100 Subject: [PATCH 4/7] ARIES-1650 Change warning message --- .../src/main/java/org/apache/aries/plugin/esa/EsaMojo.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esa-maven-plugin/src/main/java/org/apache/aries/plugin/esa/EsaMojo.java b/esa-maven-plugin/src/main/java/org/apache/aries/plugin/esa/EsaMojo.java index 676e845867..2f263e21fd 100644 --- a/esa-maven-plugin/src/main/java/org/apache/aries/plugin/esa/EsaMojo.java +++ b/esa-maven-plugin/src/main/java/org/apache/aries/plugin/esa/EsaMojo.java @@ -559,7 +559,7 @@ private Set selectNonJarArtifactsAndBundles(Set artifacts) if (isNonJarOrOSGiBundle(artifact)) { selected.add(artifact); } else { - getLog().warn("Found dependency on non-bundle JAR! groupId: " + artifact.getGroupId() + " artifactId:" + artifact.getArtifactId()); + getLog().warn("Skipping dependency on non-bundle JAR! groupId: " + artifact.getGroupId() + " artifactId:" + artifact.getArtifactId()); } } return selected; From 54f3c1606ccf68710462368bdd23d069746cc745 Mon Sep 17 00:00:00 2001 From: Tom De Wolf Date: Thu, 2 Mar 2017 18:35:05 +0100 Subject: [PATCH 5/7] ARIES-1650 unused imports fix --- .../main/java/org/apache/aries/plugin/esa/EsaMojo.java | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/esa-maven-plugin/src/main/java/org/apache/aries/plugin/esa/EsaMojo.java b/esa-maven-plugin/src/main/java/org/apache/aries/plugin/esa/EsaMojo.java index 6d3ab72bd9..c28da573ee 100644 --- a/esa-maven-plugin/src/main/java/org/apache/aries/plugin/esa/EsaMojo.java +++ b/esa-maven-plugin/src/main/java/org/apache/aries/plugin/esa/EsaMojo.java @@ -19,16 +19,6 @@ * under the License. */ -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.Set; - -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.project.MavenProject; -import org.codehaus.plexus.archiver.zip.ZipArchiver; import static org.apache.aries.util.manifest.BundleManifest.fromBundle; import java.io.File; From 4e87120522871c252e0b6ffc960b3af37baa18b4 Mon Sep 17 00:00:00 2001 From: Tom De Wolf Date: Thu, 2 Mar 2017 19:01:18 +0100 Subject: [PATCH 6/7] =?UTF-8?q?ARIES-1650=20don=E2=80=99t=20make=20it=20a?= =?UTF-8?q?=20feature,=20it=20is=20a=20bug=20to=20include=20jars=20in=20an?= =?UTF-8?q?=20esa=20that=20are=20not=20osgi=20bundles,=20they=20cannot=20b?= =?UTF-8?q?e=20installed=20in=20osgi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/apache/aries/plugin/esa/EsaMojo.java | 16 +++------------- .../plugin-config.xml | 1 - .../basic-esa-content-type/plugin-config.xml | 1 - .../plugin-config.xml | 1 - .../plugin-config.xml | 1 - .../unit/basic-esa-no-bundles/plugin-config.xml | 1 - .../basic-esa-start-order/plugin-config.xml | 1 - .../plugin-config.xml | 1 - .../target/maven-esa-test-1.0-SNAPSHOT.jar | Bin 25 -> 1268 bytes .../unit/basic-esa-test/plugin-config.xml | 1 - .../basic-esa-with-descriptor/plugin-config.xml | 1 - .../basic-esa-with-manifest/plugin-config.xml | 1 - .../plugin-config.xml | 1 - 13 files changed, 3 insertions(+), 24 deletions(-) diff --git a/esa-maven-plugin/src/main/java/org/apache/aries/plugin/esa/EsaMojo.java b/esa-maven-plugin/src/main/java/org/apache/aries/plugin/esa/EsaMojo.java index c28da573ee..8d766f816a 100644 --- a/esa-maven-plugin/src/main/java/org/apache/aries/plugin/esa/EsaMojo.java +++ b/esa-maven-plugin/src/main/java/org/apache/aries/plugin/esa/EsaMojo.java @@ -189,13 +189,6 @@ public enum EsaManifestContent {all, content}; */ private String archiveContent; - /** - * Whether non-bundle JAR files should be included in the archive - * - * @parameter expression="${includeNonBundleJars}" default-value="true" - */ - private boolean includeNonBundleJars; - /** * Define which bundles to include in the manifest Subsystem-Content header. * all - direct and transitive dependencies go into the Subsystem-Content header @@ -250,9 +243,8 @@ private void addDependenciesToArchive() throws MojoExecutionException { } artifacts = selectArtifactsInCompileOrRuntimeScope(artifacts); - if(!includeNonBundleJars){ - artifacts = selectNonJarArtifactsAndBundles(artifacts); - } + artifacts = selectNonJarArtifactsAndBundles(artifacts); + int cnt = 0; for (Artifact artifact : artifacts) { if (!artifact.isOptional() /*&& filter.include(artifact)*/) { @@ -453,9 +445,7 @@ private void writeSubsystemManifest(String fileName) } artifacts = selectArtifactsInCompileOrRuntimeScope(artifacts); - if(!includeNonBundleJars){ - artifacts = selectNonJarArtifactsAndBundles(artifacts); - } + artifacts = selectNonJarArtifactsAndBundles(artifacts); Iterator iter = artifacts.iterator(); diff --git a/esa-maven-plugin/src/test/resources/unit/basic-esa-content-bundles-only/plugin-config.xml b/esa-maven-plugin/src/test/resources/unit/basic-esa-content-bundles-only/plugin-config.xml index 5f71bf30f6..4c7fac0094 100644 --- a/esa-maven-plugin/src/test/resources/unit/basic-esa-content-bundles-only/plugin-config.xml +++ b/esa-maven-plugin/src/test/resources/unit/basic-esa-content-bundles-only/plugin-config.xml @@ -22,7 +22,6 @@ true true - true ${basedir}/target/unit/basic-esa-content-bundles-only/target/esa-test-content-bundles-only ${basedir}/target/unit/basic-esa-content-bundles-only/target/maven-shared-archive-resources diff --git a/esa-maven-plugin/src/test/resources/unit/basic-esa-content-type/plugin-config.xml b/esa-maven-plugin/src/test/resources/unit/basic-esa-content-type/plugin-config.xml index c0054e8d04..9de241f923 100644 --- a/esa-maven-plugin/src/test/resources/unit/basic-esa-content-type/plugin-config.xml +++ b/esa-maven-plugin/src/test/resources/unit/basic-esa-content-type/plugin-config.xml @@ -19,7 +19,6 @@ true false true - true ${basedir}/target/unit/basic-esa-content-type/target/esa-test-content-type ${basedir}/target/unit/basic-esa-content-type/target/maven-shared-archive-resources diff --git a/esa-maven-plugin/src/test/resources/unit/basic-esa-custom-instructions/plugin-config.xml b/esa-maven-plugin/src/test/resources/unit/basic-esa-custom-instructions/plugin-config.xml index 350f614f14..82ecbc2c00 100644 --- a/esa-maven-plugin/src/test/resources/unit/basic-esa-custom-instructions/plugin-config.xml +++ b/esa-maven-plugin/src/test/resources/unit/basic-esa-custom-instructions/plugin-config.xml @@ -33,7 +33,6 @@ under the License. false true - true ${basedir}/target/unit/basic-esa-custom-instructions/target/esa-test-custom-instructions ${basedir}/target/unit/basic-esa-custom-instructions/target/maven-shared-archive-resources ${basedir}/target/unit/basic-esa-custom-instructions/target diff --git a/esa-maven-plugin/src/test/resources/unit/basic-esa-exclude-non-bundle-jars/plugin-config.xml b/esa-maven-plugin/src/test/resources/unit/basic-esa-exclude-non-bundle-jars/plugin-config.xml index 8118c0f03b..1fca74d3df 100644 --- a/esa-maven-plugin/src/test/resources/unit/basic-esa-exclude-non-bundle-jars/plugin-config.xml +++ b/esa-maven-plugin/src/test/resources/unit/basic-esa-exclude-non-bundle-jars/plugin-config.xml @@ -30,7 +30,6 @@ under the License. true true - false ${basedir}/target/unit/basic-esa-exclude-non-bundle-jars/target/basic-esa-exclude-non-bundle-jars ${basedir}/target/unit/basic-esa-exclude-non-bundle-jars/target/maven-shared-archive-resources diff --git a/esa-maven-plugin/src/test/resources/unit/basic-esa-no-bundles/plugin-config.xml b/esa-maven-plugin/src/test/resources/unit/basic-esa-no-bundles/plugin-config.xml index 3fbd57ea95..5ca01e800e 100644 --- a/esa-maven-plugin/src/test/resources/unit/basic-esa-no-bundles/plugin-config.xml +++ b/esa-maven-plugin/src/test/resources/unit/basic-esa-no-bundles/plugin-config.xml @@ -22,7 +22,6 @@ true true - true ${basedir}/target/unit/basic-esa-no-bundles/target/esa-test-no-bundles ${basedir}/target/unit/basic-esa-no-bundles/target/maven-shared-archive-resources diff --git a/esa-maven-plugin/src/test/resources/unit/basic-esa-start-order/plugin-config.xml b/esa-maven-plugin/src/test/resources/unit/basic-esa-start-order/plugin-config.xml index 55fb1950bf..e06ce1a574 100644 --- a/esa-maven-plugin/src/test/resources/unit/basic-esa-start-order/plugin-config.xml +++ b/esa-maven-plugin/src/test/resources/unit/basic-esa-start-order/plugin-config.xml @@ -29,7 +29,6 @@ under the License. true - true ${basedir}/target/unit/basic-esa-start-order/target/esa-test-start-order ${basedir}/target/unit/basic-esa-start-order/target/maven-shared-archive-resources ${basedir}/target/unit/basic-esa-start-order/target diff --git a/esa-maven-plugin/src/test/resources/unit/basic-esa-test-with-pgk-type/plugin-config.xml b/esa-maven-plugin/src/test/resources/unit/basic-esa-test-with-pgk-type/plugin-config.xml index 5f0cf51d61..e4da77c0fd 100644 --- a/esa-maven-plugin/src/test/resources/unit/basic-esa-test-with-pgk-type/plugin-config.xml +++ b/esa-maven-plugin/src/test/resources/unit/basic-esa-test-with-pgk-type/plugin-config.xml @@ -27,7 +27,6 @@ under the License. ${basedir}/src/test/resources/unit/basic-esa-test-with-pgk-type/src/main/esa/OSGI-INF/SUBSYSTEM.MF true true - true ${basedir}/src/main/esa/META-INF/MANIFEST.MF ${basedir}/target/unit/basic-esa-test-with-pgk-type/target/esa-test ${basedir}/target/unit/basic-esa-test-with-pgk-type/target/maven-shared-archive-resources diff --git a/esa-maven-plugin/src/test/resources/unit/basic-esa-test-with-pgk-type/target/maven-esa-test-1.0-SNAPSHOT.jar b/esa-maven-plugin/src/test/resources/unit/basic-esa-test-with-pgk-type/target/maven-esa-test-1.0-SNAPSHOT.jar index 6f5f2f8125ccd896a69ee61a770d2804a6bb2565..cfc62a2a45d2d188a4747b1dd9f5eb610ada8a34 100644 GIT binary patch literal 1268 zcmWIWW@h1H00HLdNnT(El;C6#VDNPfan$wnbJGuv;9+7y3MzNyur zL-9R#sbtJtL49$c%h)+ec85HR0D5B`5QAI_@t`c4OF=^n|2@557KOANa#M0vebmNHD7lNHcyEQegYI z-cW#5#@VT9fzO0KNr#;FWi5h=db8%tUp+k{V8Y~8;SsYUrpySRG;{i?fED=(6LK_v^OACN5+A;Llaa9MbxOvY71>FTk`}&B$;?^t`bAPgO5TH4 zSx=I3&Vd4xoug9SKe!VZu-Bl03-Kj->JdivCD3!wgak_kuyiztea6Tn%8V;#@BsY| z1`cl>K{U*Jz+}V$&nE%iAR`co06A5PFd!MxXpU?IN;-g;2Ff!K)37H=P9)R*Iz9xN zhLo-$Mu5^KJ|l!sjF4bNG6KVM2(u8LLrxX)NMqP+YPg~U9C#N?9F#2kgJ#3BH4rU>i+ diff --git a/esa-maven-plugin/src/test/resources/unit/basic-esa-test/plugin-config.xml b/esa-maven-plugin/src/test/resources/unit/basic-esa-test/plugin-config.xml index 2b363f1702..48d662e791 100644 --- a/esa-maven-plugin/src/test/resources/unit/basic-esa-test/plugin-config.xml +++ b/esa-maven-plugin/src/test/resources/unit/basic-esa-test/plugin-config.xml @@ -27,7 +27,6 @@ under the License. ${basedir}/src/test/resources/unit/basic-esa-test/src/main/esa/OSGI-INF/SUBSYSTEM.MF true true - true ${basedir}/src/main/esa/META-INF/MANIFEST.MF ${basedir}/target/unit/basic-esa-test/target/esa-test ${basedir}/target/unit/basic-esa-test/target/maven-shared-archive-resources diff --git a/esa-maven-plugin/src/test/resources/unit/basic-esa-with-descriptor/plugin-config.xml b/esa-maven-plugin/src/test/resources/unit/basic-esa-with-descriptor/plugin-config.xml index bec4060c69..14c11419da 100644 --- a/esa-maven-plugin/src/test/resources/unit/basic-esa-with-descriptor/plugin-config.xml +++ b/esa-maven-plugin/src/test/resources/unit/basic-esa-with-descriptor/plugin-config.xml @@ -27,7 +27,6 @@ under the License. ${basedir}/src/test/resources/unit/basic-esa-with-descriptor/src/main/esa/OSGI-INF/SUBSYSTEM.MF true true - true ${basedir}/src/test/resources/unit/basic-esa-with-descriptor/src/main/esa/META-INF/MANIFEST.MF ${basedir}/target/unit/basic-esa-with-descriptor/target/esa-test-with-descriptor ${basedir}/target/unit/basic-esa-with-descriptor/target/maven-shared-archive-resources diff --git a/esa-maven-plugin/src/test/resources/unit/basic-esa-with-manifest/plugin-config.xml b/esa-maven-plugin/src/test/resources/unit/basic-esa-with-manifest/plugin-config.xml index 98cc8aa6b7..c3326ddcbc 100644 --- a/esa-maven-plugin/src/test/resources/unit/basic-esa-with-manifest/plugin-config.xml +++ b/esa-maven-plugin/src/test/resources/unit/basic-esa-with-manifest/plugin-config.xml @@ -27,7 +27,6 @@ under the License. ${basedir}/src/test/resources/unit/basic-esa-with-manifest/src/main/esa/OSGI-INF/SUBSYSTEM.MF true true - true ${basedir}/src/test/resources/unit/basic-esa-with-manifest/src/main/esa/META-INF/MANIFEST.MF ${basedir}/target/unit/basic-esa-with-manifest/target/esa-test-with-manifest ${basedir}/target/unit/basic-esa-with-manifest/target/maven-shared-archive-resources diff --git a/esa-maven-plugin/src/test/resources/unit/basic-esa-without-manifest/plugin-config.xml b/esa-maven-plugin/src/test/resources/unit/basic-esa-without-manifest/plugin-config.xml index 8310f2aceb..8417f6656b 100644 --- a/esa-maven-plugin/src/test/resources/unit/basic-esa-without-manifest/plugin-config.xml +++ b/esa-maven-plugin/src/test/resources/unit/basic-esa-without-manifest/plugin-config.xml @@ -31,7 +31,6 @@ under the License. true true - true ${basedir}/target/unit/basic-esa-without-manifest/target/esa-test-without-manifest ${basedir}/target/unit/basic-esa-without-manifest/target/maven-shared-archive-resources ${basedir}/target/unit/basic-esa-without-manifest/target From 52851aa9507b36037505e0f019d1aa66e46202e2 Mon Sep 17 00:00:00 2001 From: Tom De Wolf Date: Thu, 2 Mar 2017 19:08:04 +0100 Subject: [PATCH 7/7] ARIES-1650 upload new jar that is no bundle --- ...tifact05-no-bundle-manifest-1.1-SNAPSHOT.jar | Bin 327 -> 327 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/esa-maven-plugin/src/test/remote-repo/org/apache/maven/test/maven-artifact05-no-bundle-manifest/1.1-SNAPSHOT/maven-artifact05-no-bundle-manifest-1.1-SNAPSHOT.jar b/esa-maven-plugin/src/test/remote-repo/org/apache/maven/test/maven-artifact05-no-bundle-manifest/1.1-SNAPSHOT/maven-artifact05-no-bundle-manifest-1.1-SNAPSHOT.jar index 988d49a5b135ebb0f292d6fbe538352d5c40036a..f157265e98e8092bbf76da202db00e649fb01c80 100644 GIT binary patch delta 37 lcmX@kbew5|HVc3Jj);l+cFaI}VnH^9d*2Jhovgzs4FL2p45I)5 delta 37 mcmX@kbew5|HjCTV$l!_kcFZvhxf2VrA>8|3Ans%xMri=^wG2A|