diff options
author | Mark Donszelmann <Mark.Donszelmann@gmail.com> | 2009-12-18 14:31:04 +0100 |
---|---|---|
committer | Mark Donszelmann <Mark.Donszelmann@gmail.com> | 2009-12-18 14:31:04 +0100 |
commit | bfe32fa8112c622d29026549091716776240ba3b (patch) | |
tree | f4f3d85517d63197d0de54057300a253bad9223c /src/main | |
parent | 213ef1f50fcec99fc310c3d1b6c949f896e9de41 (diff) | |
download | maven-nar-plugin-bfe32fa8112c622d29026549091716776240ba3b.tar.gz maven-nar-plugin-bfe32fa8112c622d29026549091716776240ba3b.tar.bz2 maven-nar-plugin-bfe32fa8112c622d29026549091716776240ba3b.tar.xz maven-nar-plugin-bfe32fa8112c622d29026549091716776240ba3b.zip |
Fixed NAR-121
Diffstat (limited to 'src/main')
6 files changed, 25 insertions, 15 deletions
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> |