diff options
19 files changed, 74 insertions, 19 deletions
diff --git a/src/it/it0004-java-dep-jni/pom.xml b/src/it/it0004-java-dep-jni/pom.xml index 4f013fd..fc7a90d 100644 --- a/src/it/it0004-java-dep-jni/pom.xml +++ b/src/it/it0004-java-dep-jni/pom.xml @@ -56,6 +56,7 @@ under the License. <groupId>org.apache.maven.its.nar</groupId> <artifactId>it0003-jni</artifactId> <version>1.0-SNAPSHOT</version> + <type>nar</type> </dependency> </dependencies> </project> diff --git a/src/it/it0008-executable-dep-lib-shared/pom.xml b/src/it/it0008-executable-dep-lib-shared/pom.xml index 85ea407..8abea53 100644 --- a/src/it/it0008-executable-dep-lib-shared/pom.xml +++ b/src/it/it0008-executable-dep-lib-shared/pom.xml @@ -59,11 +59,13 @@ under the License. </plugin> </plugins> </build> + <dependencies> <dependency> <groupId>org.apache.maven.its.nar</groupId> <artifactId>it0007-lib-shared</artifactId> <version>1.0-SNAPSHOT</version> + <type>nar</type> </dependency> </dependencies> </project> diff --git a/src/it/it0009-jni-dep-lib-shared/pom.xml b/src/it/it0009-jni-dep-lib-shared/pom.xml index 42ebba5..f893424 100644 --- a/src/it/it0009-jni-dep-lib-shared/pom.xml +++ b/src/it/it0009-jni-dep-lib-shared/pom.xml @@ -66,6 +66,7 @@ under the License. <groupId>org.apache.maven.its.nar</groupId> <artifactId>it0007-lib-shared</artifactId> <version>1.0-SNAPSHOT</version> + <type>nar</type> </dependency> </dependencies> </project> diff --git a/src/it/it0011-executable-dep-lib-static/pom.xml b/src/it/it0011-executable-dep-lib-static/pom.xml index 476ef0d..95a11a6 100644 --- a/src/it/it0011-executable-dep-lib-static/pom.xml +++ b/src/it/it0011-executable-dep-lib-static/pom.xml @@ -65,6 +65,7 @@ under the License. <groupId>org.apache.maven.its.nar</groupId> <artifactId>it0010-lib-static</artifactId> <version>1.0-SNAPSHOT</version> + <type>nar</type> </dependency> </dependencies> </project> diff --git a/src/it/it0012-jni-dep-lib-static/pom.xml b/src/it/it0012-jni-dep-lib-static/pom.xml index 0dcd7c3..adee1ac 100644 --- a/src/it/it0012-jni-dep-lib-static/pom.xml +++ b/src/it/it0012-jni-dep-lib-static/pom.xml @@ -66,6 +66,7 @@ under the License. <groupId>org.apache.maven.its.nar</groupId> <artifactId>it0010-lib-static</artifactId> <version>1.0-SNAPSHOT</version> + <type>nar</type> </dependency> </dependencies> </project> diff --git a/src/it/it0014-multi-module/it0014-jni-dep-lib-shared/pom.xml b/src/it/it0014-multi-module/it0014-jni-dep-lib-shared/pom.xml index 997ec91..90439ad 100644 --- a/src/it/it0014-multi-module/it0014-jni-dep-lib-shared/pom.xml +++ b/src/it/it0014-multi-module/it0014-jni-dep-lib-shared/pom.xml @@ -42,7 +42,6 @@ under the License. </properties> <build> - <defaultGoal>integration-test</defaultGoal> <plugins> <plugin> <artifactId>maven-nar-plugin</artifactId> @@ -65,6 +64,7 @@ under the License. <groupId>org.apache.maven.its.nar</groupId> <artifactId>it0014-lib-shared</artifactId> <version>1.0-SNAPSHOT</version> + <type>nar</type> </dependency> </dependencies> </project> diff --git a/src/it/it0014-multi-module/it0014-lib-shared/pom.xml b/src/it/it0014-multi-module/it0014-lib-shared/pom.xml index d18fb04..8a71389 100644 --- a/src/it/it0014-multi-module/it0014-lib-shared/pom.xml +++ b/src/it/it0014-multi-module/it0014-lib-shared/pom.xml @@ -43,7 +43,6 @@ under the License. </properties> <build> - <defaultGoal>install</defaultGoal> <plugins> <plugin> <artifactId>maven-nar-plugin</artifactId> diff --git a/src/it/it0014-multi-module/pom.xml b/src/it/it0014-multi-module/pom.xml index 1b349dc..67f3f7c 100644 --- a/src/it/it0014-multi-module/pom.xml +++ b/src/it/it0014-multi-module/pom.xml @@ -40,10 +40,10 @@ under the License. <url>http://maven.apache.org/</url> <build> -<!-- <defaultGoal>integration-test</defaultGoal> ---> +<!-- <defaultGoal>install</defaultGoal> +--> </build> <modules> diff --git a/src/it/it0016-layout/it0016-executable-dep-lib-shared-layout20/pom.xml b/src/it/it0016-layout/it0016-executable-dep-lib-shared-layout20/pom.xml index 9974d0a..3ec4393 100644 --- a/src/it/it0016-layout/it0016-executable-dep-lib-shared-layout20/pom.xml +++ b/src/it/it0016-layout/it0016-executable-dep-lib-shared-layout20/pom.xml @@ -60,11 +60,13 @@ under the License. </plugin> </plugins> </build> + <dependencies> <dependency> <groupId>org.apache.maven.its.nar</groupId> <artifactId>it0016-lib-shared-layout20</artifactId> <version>1.0-SNAPSHOT</version> + <type>nar</type> </dependency> </dependencies> </project> diff --git a/src/it/it0016-layout/it0016-executable-dep-lib-shared-layout21/pom.xml b/src/it/it0016-layout/it0016-executable-dep-lib-shared-layout21/pom.xml index 3322daa..d5e21ef 100644 --- a/src/it/it0016-layout/it0016-executable-dep-lib-shared-layout21/pom.xml +++ b/src/it/it0016-layout/it0016-executable-dep-lib-shared-layout21/pom.xml @@ -58,11 +58,13 @@ under the License. </plugin> </plugins> </build> + <dependencies> <dependency> <groupId>org.apache.maven.its.nar</groupId> <artifactId>it0016-lib-shared-layout21</artifactId> <version>1.0-SNAPSHOT</version> + <type>nar</type> </dependency> </dependencies> </project> diff --git a/src/it/it0021-executable-dep-lib-3rdparty/pom.xml b/src/it/it0021-executable-dep-lib-3rdparty/pom.xml index b39096b..60e5504 100644 --- a/src/it/it0021-executable-dep-lib-3rdparty/pom.xml +++ b/src/it/it0021-executable-dep-lib-3rdparty/pom.xml @@ -59,11 +59,13 @@ under the License. </plugin> </plugins> </build> + <dependencies> <dependency> <groupId>org.apache.maven.its.nar</groupId> <artifactId>it0020-lib-3rdparty</artifactId> <version>1.0-SNAPSHOT</version> + <type>nar</type> </dependency> </dependencies> </project> diff --git a/src/main/java/org/apache/maven/plugin/nar/NarDownloadMojo.java b/src/main/java/org/apache/maven/plugin/nar/NarDownloadMojo.java index d7f6343..fa83de7 100644 --- a/src/main/java/org/apache/maven/plugin/nar/NarDownloadMojo.java +++ b/src/main/java/org/apache/maven/plugin/nar/NarDownloadMojo.java @@ -40,7 +40,7 @@ public class NarDownloadMojo { /** - * Artifact resolver, needed to download source jars for inclusion in classpath. + * Artifact resolver, needed to download the attached nar files. * * @component role="org.apache.maven.artifact.resolver.ArtifactResolver" * @required @@ -49,7 +49,7 @@ public class NarDownloadMojo private ArtifactResolver artifactResolver; /** - * Remote repositories which will be searched for source attachments. + * Remote repositories which will be searched for nar attachments. * * @parameter expression="${project.remoteArtifactRepositories}" * @required diff --git a/src/main/java/org/apache/maven/plugin/nar/NarIntegrationTestMojo.java b/src/main/java/org/apache/maven/plugin/nar/NarIntegrationTestMojo.java index ac4fcf7..7f929bf 100644 --- a/src/main/java/org/apache/maven/plugin/nar/NarIntegrationTestMojo.java +++ b/src/main/java/org/apache/maven/plugin/nar/NarIntegrationTestMojo.java @@ -999,9 +999,9 @@ public class NarIntegrationTestMojo // add jar file to classpath, as one may want to read a // properties file for artifactId and version - String jarFile = "target/" + project.getArtifactId() + "-" + project.getVersion() + ".jar"; - getLog().debug( "Adding to surefire test classpath: " + jarFile ); - surefireBooter.addClassPathUrl( jarFile ); + String narFile = "target/" + project.getArtifactId() + "-" + project.getVersion() + ".jar"; + getLog().debug( "Adding to surefire test classpath: " + narFile ); + surefireBooter.addClassPathUrl( narFile ); } List dependencies = getNarManager().getNarDependencies( "test" ); diff --git a/src/main/java/org/apache/maven/plugin/nar/NarLayout.java b/src/main/java/org/apache/maven/plugin/nar/NarLayout.java index 9529473..6e12eaa 100644 --- a/src/main/java/org/apache/maven/plugin/nar/NarLayout.java +++ b/src/main/java/org/apache/maven/plugin/nar/NarLayout.java @@ -68,7 +68,7 @@ public interface NarLayout throws MojoExecutionException, MojoFailureException; /** - * Called to attach nars to main jar file. This method needs to produce all the attached nar files and set NarInfo + * Called to attach nars to main nar/jar file. This method needs to produce all the attached nar files and set NarInfo * accordingly. */ void attachNars( File baseDir, ArchiverManager archiverManager, MavenProjectHelper projectHelper, diff --git a/src/main/java/org/apache/maven/plugin/nar/NarManager.java b/src/main/java/org/apache/maven/plugin/nar/NarManager.java index 7181a35..4e75cd4 100644 --- a/src/main/java/org/apache/maven/plugin/nar/NarManager.java +++ b/src/main/java/org/apache/maven/plugin/nar/NarManager.java @@ -264,17 +264,17 @@ public class NarManager return null; } - JarFile jar = null; + JarFile nar = null; try { - jar = new JarFile( file ); + nar = new JarFile( file ); NarInfo info = new NarInfo( dependency.getGroupId(), dependency.getArtifactId(), dependency.getVersion(), log ); - if ( !info.exists( jar ) ) + if ( !info.exists( nar ) ) { return null; } - info.read( jar ); + info.read( nar ); return info; } catch ( IOException e ) @@ -283,11 +283,11 @@ public class NarManager } finally { - if ( jar != null ) + if ( nar != null ) { try { - jar.close(); + nar.close(); } catch ( IOException e ) { diff --git a/src/main/java/org/apache/maven/plugin/nar/NarPackageMojo.java b/src/main/java/org/apache/maven/plugin/nar/NarPackageMojo.java index f2a01ec..8c55f5c 100644 --- a/src/main/java/org/apache/maven/plugin/nar/NarPackageMojo.java +++ b/src/main/java/org/apache/maven/plugin/nar/NarPackageMojo.java @@ -40,7 +40,9 @@ public class NarPackageMojo extends AbstractCompileMojo { /** - * @component role="org.apache.maven.artifact.handler.ArtifactHandler" roleHint="nar-package" + * NAR-121 was nar-package + * + * @component role="org.apache.maven.artifact.handler.ArtifactHandler" roleHint="nar" * @required */ private ArtifactHandler narArtifactHandler; @@ -64,8 +66,10 @@ public class NarPackageMojo throws MojoExecutionException, MojoFailureException { // Avoid that -DupdateReleaseInfo copies to a .nar file - getMavenProject().getArtifact().setArtifactHandler( narArtifactHandler ); - + // NAR-121 +// getMavenProject().getArtifact().setArtifactHandler( narArtifactHandler ); + System.err.println("***"+getMavenProject().getArtifact().getArtifactHandler().getExtension()); + System.err.println("***"+getFinalName()); // let the layout decide which nars to attach getLayout().attachNars( getTargetDirectory(), archiverManager, projectHelper, getMavenProject(), getNarInfo() ); diff --git a/src/main/resources/META-INF/plexus/components.xml b/src/main/resources/META-INF/plexus/components.xml index 4b508c1..aa6d8b2 100644 --- a/src/main/resources/META-INF/plexus/components.xml +++ b/src/main/resources/META-INF/plexus/components.xml @@ -73,12 +73,18 @@ <!-- Do not declare the NarArtifactHandler here for role-hint nar, as we really use the DefaultArtifactHandler, except for packing --> <component> <role>org.apache.maven.artifact.handler.ArtifactHandler</role> +<!-- NAR-121 <role-hint>nar-package</role-hint> + --> + <role-hint>nar</role-hint> <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler </implementation> <configuration> <type>nar</type> +<!-- NAR-121 <extension>jar</extension> +--> + <extension>nar</extension> <packaging>nar</packaging> <language>java</language> <addedToClasspath>true</addedToClasspath> diff --git a/src/site/apt/compatibility.apt b/src/site/apt/compatibility.apt new file mode 100644 index 0000000..ce25282 --- /dev/null +++ b/src/site/apt/compatibility.apt @@ -0,0 +1,32 @@ + --- +Maven NAR Plugin + --- + --- +Mark Donszelmann + --- + +Compatibility + + For most of the NAR plugin we try to keep things backwards compatible. Versions 1.x were +made for Maven 1 and therefore we are not compatible with those. + + In the NAR Plugin 2.x series we had to introduce some backward incompatibilites and other changes. +Below a (rather incomplete) list. + +* Version 2.1.x + + * The internal layout of the nar files (.nar extension) is stable. No changes were made. + + * The layout of the files under target and under the unpacked directory has changed. For more +information see NarLayout21 (version 2.1.x and up) and NarLayout20 (version 2.0.x). + + * The dependency in 2.0 used to be without a <type> specified. You now need to specify <type>nar</type> +as this is more in line with the standard of maven. It also allows the NAR plugin to find dependencies +locally in a multi-module build. + + * The main artifact is a jar file, where the NAR plugin attaches a -noarch nar file and some +platform specific nar files. When installed and or deployed the main jar file is renamed to a nar file, +hence the dependecy type change from jar to nar. + + [] + diff --git a/src/site/site.xml b/src/site/site.xml index 7e98cd5..918522f 100644 --- a/src/site/site.xml +++ b/src/site/site.xml @@ -44,6 +44,8 @@ under the License. <item name="FAQ" href="faq.html"/> <item name="AOL Properties" href="aol.html"/> <item name="Examples" href="examples.html"/> + <item name="Archetypes" href="archetypes.html"/> + <item name="Compatibility" href="compatibility.html"/> </menu> <menu name="Developer Info"> |