Author: sisbell Date: Tue Jun 19 21:19:03 2007 New Revision: 548927 URL: http://svn.apache.org/viewvc?view=rev&rev=548927 Log: Fix for NMAVEN-81
Modified: incubator/nmaven/trunk/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/FileInstallerMojo.java Modified: incubator/nmaven/trunk/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/FileInstallerMojo.java URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/FileInstallerMojo.java?view=diff&rev=548927&r1=548926&r2=548927 ============================================================================== --- incubator/nmaven/trunk/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/FileInstallerMojo.java (original) +++ incubator/nmaven/trunk/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/FileInstallerMojo.java Tue Jun 19 21:19:03 2007 @@ -26,6 +26,8 @@ import org.apache.maven.dotnet.artifact.ArtifactContext; import org.apache.maven.artifact.installer.ArtifactInstallationException; +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.factory.ArtifactFactory; /** * @goal install-file @@ -101,6 +103,13 @@ */ private org.apache.maven.dotnet.NMavenRepositoryRegistry nmavenRegistry; + /** + * The artifact factory component, which is used for creating artifacts. + * + * @component + */ + private ArtifactFactory artifactFactory; + public void execute() throws MojoExecutionException { @@ -110,11 +119,11 @@ throw new MojoExecutionException( "NMAVEN-1000-002: Pom File is missing: File = " + pomFile.getAbsolutePath() ); } - else if ( generatePom && pomFile == null ) + else if ( generatePom && pomFile == null ) { try { - + this.getLog().info( "NMAVEN-xxx-000: Installing file with generated pom" ); artifactContext.getArtifactInstaller().installFileWithGeneratedPom( groupId, artifactId, version, packaging, artifactFile ); } @@ -123,21 +132,26 @@ throw new MojoExecutionException( "NMAVEN-1000-000: Failed to install artifact file", e ); } } - else if(pomFile != null) + else if ( pomFile != null ) { + Artifact sourceArtifact = + artifactFactory.createArtifact( groupId, artifactId, version, "compile", packaging ); + sourceArtifact.setFile( artifactFile ); + this.getLog().info( "NMAVEN-xxx-000: Installing file with specified pom" ); try { - artifactContext.getArtifactInstaller().installArtifact( project.getArtifact(), pomFile); + artifactContext.getArtifactInstaller().installArtifact( sourceArtifact, pomFile ); } catch ( ArtifactInstallationException e ) { - throw new MojoExecutionException( "NMAVEN-1000-003: Failed to install artifact file", e ); + throw new MojoExecutionException( "NMAVEN-1000-003: Failed to install artifact file", e ); } } else { try { + this.getLog().info( "NMAVEN-xxx-000: Installing file with no pom" ); artifactContext.getArtifactInstaller().installFileWithNoPom( groupId, artifactId, version, artifactFile ); }