From bfe32fa8112c622d29026549091716776240ba3b Mon Sep 17 00:00:00 2001 From: Mark Donszelmann Date: Fri, 18 Dec 2009 14:31:04 +0100 Subject: Fixed NAR-121 --- src/it/it0004-java-dep-jni/pom.xml | 1 + src/it/it0008-executable-dep-lib-shared/pom.xml | 2 ++ src/it/it0009-jni-dep-lib-shared/pom.xml | 1 + src/it/it0011-executable-dep-lib-static/pom.xml | 1 + src/it/it0012-jni-dep-lib-static/pom.xml | 1 + .../it0014-jni-dep-lib-shared/pom.xml | 2 +- .../it0014-multi-module/it0014-lib-shared/pom.xml | 1 - src/it/it0014-multi-module/pom.xml | 4 +-- .../pom.xml | 2 ++ .../pom.xml | 2 ++ src/it/it0021-executable-dep-lib-3rdparty/pom.xml | 2 ++ .../apache/maven/plugin/nar/NarDownloadMojo.java | 4 +-- .../maven/plugin/nar/NarIntegrationTestMojo.java | 6 ++-- .../org/apache/maven/plugin/nar/NarLayout.java | 2 +- .../org/apache/maven/plugin/nar/NarManager.java | 12 ++++---- .../apache/maven/plugin/nar/NarPackageMojo.java | 10 +++++-- src/main/resources/META-INF/plexus/components.xml | 6 ++++ src/site/apt/compatibility.apt | 32 ++++++++++++++++++++++ src/site/site.xml | 2 ++ 19 files changed, 74 insertions(+), 19 deletions(-) create mode 100644 src/site/apt/compatibility.apt 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. org.apache.maven.its.nar it0003-jni 1.0-SNAPSHOT + nar 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. + org.apache.maven.its.nar it0007-lib-shared 1.0-SNAPSHOT + nar 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. org.apache.maven.its.nar it0007-lib-shared 1.0-SNAPSHOT + nar 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. org.apache.maven.its.nar it0010-lib-static 1.0-SNAPSHOT + nar 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. org.apache.maven.its.nar it0010-lib-static 1.0-SNAPSHOT + nar 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. - integration-test maven-nar-plugin @@ -65,6 +64,7 @@ under the License. org.apache.maven.its.nar it0014-lib-shared 1.0-SNAPSHOT + nar 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. - install maven-nar-plugin 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. http://maven.apache.org/ - + 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. + org.apache.maven.its.nar it0016-lib-shared-layout20 1.0-SNAPSHOT + nar 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. + org.apache.maven.its.nar it0016-lib-shared-layout21 1.0-SNAPSHOT + nar 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. + org.apache.maven.its.nar it0020-lib-3rdparty 1.0-SNAPSHOT + nar 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 @@ org.apache.maven.artifact.handler.ArtifactHandler + + nar org.apache.maven.artifact.handler.DefaultArtifactHandler nar + + nar nar java true 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 specified. You now need to specify nar +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. + + -- cgit v1.2.3