You are viewing a plain text version of this content. The canonical link for it is here.
Posted to nmaven-commits@incubator.apache.org by si...@apache.org on 2007/06/20 04:44:38 UTC

svn commit: r548931 - in /incubator/nmaven/trunk: components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/ components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/ plugins/maven-install-plugin/src/main/java/org/...

Author: sisbell
Date: Tue Jun 19 21:44:36 2007
New Revision: 548931

URL: http://svn.apache.org/viewvc?view=rev&rev=548931
Log:
Fixed bug where the pom metadata (from the executing directory) was inadvertently being included within the install file's pom.

Modified:
    incubator/nmaven/trunk/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/ArtifactInstaller.java
    incubator/nmaven/trunk/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/ArtifactInstallerImpl.java
    incubator/nmaven/trunk/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/FileInstallerMojo.java
    incubator/nmaven/trunk/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/InstallerMojo.java

Modified: incubator/nmaven/trunk/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/ArtifactInstaller.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/ArtifactInstaller.java?view=diff&rev=548931&r1=548930&r2=548931
==============================================================================
--- incubator/nmaven/trunk/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/ArtifactInstaller.java (original)
+++ incubator/nmaven/trunk/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/ArtifactInstaller.java Tue Jun 19 21:44:36 2007
@@ -54,9 +54,10 @@
      *
      * @param artifact the artifact to install
      * @param pomFile  the pom file of the installed artifact
+     * @param modifyProjectMetadata
      * @throws ArtifactInstallationException if there is a problem installing the artifact
      */
-    void installArtifact( Artifact artifact, File pomFile )
+    void installArtifact( Artifact artifact, File pomFile, boolean modifyProjectMetadata )
         throws ArtifactInstallationException;
 
     /**

Modified: incubator/nmaven/trunk/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/ArtifactInstallerImpl.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/ArtifactInstallerImpl.java?view=diff&rev=548931&r1=548930&r2=548931
==============================================================================
--- incubator/nmaven/trunk/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/ArtifactInstallerImpl.java (original)
+++ incubator/nmaven/trunk/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/ArtifactInstallerImpl.java Tue Jun 19 21:44:36 2007
@@ -176,9 +176,9 @@
     }
 
     /**
-     * @see org.apache.maven.dotnet.artifact.ArtifactInstaller#installArtifact(org.apache.maven.artifact.Artifact, java.io.File)
+     * @see org.apache.maven.dotnet.artifact.ArtifactInstaller#installArtifact(org.apache.maven.artifact.Artifact,java.io.File,boolean)
      */
-    public void installArtifact( Artifact artifact, File pomFile )
+    public void installArtifact( Artifact artifact, File pomFile, boolean modifyProjectMetadata )
         throws ArtifactInstallationException
     {
         installNetModules( artifact );
@@ -186,25 +186,28 @@
         File configExeFile = new File( applicationConfig.getConfigDestinationPath() );
         //TODO: Remove GAC dependencies before installing. This should be removed and replaced with solution in the core.
         artifact.getMetadataList().clear();
-        try
+        if ( modifyProjectMetadata )
         {
-            List<Dependency> dependencies = project.getDependencies();
-            List<Dependency> newDependencies = new ArrayList<Dependency>();
-            for ( Dependency dependency : dependencies )
+            try
             {
-                if ( !dependency.getType().startsWith( "gac" ) )
+                List<Dependency> dependencies = project.getDependencies();
+                List<Dependency> newDependencies = new ArrayList<Dependency>();
+                for ( Dependency dependency : dependencies )
                 {
-                    newDependencies.add( dependency );
+                    if ( !dependency.getType().startsWith( "gac" ) )
+                    {
+                        newDependencies.add( dependency );
+                    }
                 }
+                project.setDependencies( newDependencies );
+                artifact.addMetadata( createArtifactMetadataFor( artifact, pomFile, project.getDependencies() ) );
             }
-            project.setDependencies( newDependencies );
-            artifact.addMetadata( createArtifactMetadataFor( artifact, pomFile, project.getDependencies() ) );
-        }
-        catch ( IOException e )
-        {
-            throw new ArtifactInstallationException( "NMAVEN-002-001: Unable to add metadata to artifact", e );
+            catch ( IOException e )
+            {
+                throw new ArtifactInstallationException( "NMAVEN-002-001: Unable to add metadata to artifact", e );
+            }
+            //End GAC HACK
         }
-        //End GAC HACK
 
         if ( configExeFile.exists() )
         {
@@ -247,7 +250,14 @@
         {
             if ( artifact.getFile() != null && artifact.getFile().exists() )//maybe just a test compile and no install
             {
+                logger.info(
+                    "NMAVEN-002-018: Installing file into repository: File = " + artifact.getFile().getAbsolutePath() );
                 File artifactFile = artifact.getFile();
+                if(!modifyProjectMetadata)
+                {
+                    artifact.addMetadata( new ArtifactMetadataImpl( artifact, pomFile ) );
+                }
+                
                 mavenInstaller.install( artifactFile, artifact, artifactRepository );
                 try
                 {
@@ -260,6 +270,11 @@
                         artifact.getId() + ", File = " +
                         ( ( artifact.getFile() != null ) ? artifact.getFile().getAbsolutePath() : "" ), e );
                 }
+            }
+            else
+            {
+                logger.info( "NMAVEN-002-019: Artifact does not exist. Nothing to install: Artifact = " +
+                    artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getVersion() );
             }
         }
         catch ( ArtifactInstallationException e )

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=548931&r1=548930&r2=548931
==============================================================================
--- 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:44:36 2007
@@ -140,7 +140,7 @@
             this.getLog().info( "NMAVEN-xxx-000: Installing file with specified pom" );
             try
             {
-                artifactContext.getArtifactInstaller().installArtifact( sourceArtifact, pomFile );
+                artifactContext.getArtifactInstaller().installArtifact( sourceArtifact, pomFile, false );
             }
             catch ( ArtifactInstallationException e )
             {

Modified: incubator/nmaven/trunk/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/InstallerMojo.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/InstallerMojo.java?view=diff&rev=548931&r1=548930&r2=548931
==============================================================================
--- incubator/nmaven/trunk/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/InstallerMojo.java (original)
+++ incubator/nmaven/trunk/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/InstallerMojo.java Tue Jun 19 21:44:36 2007
@@ -82,7 +82,7 @@
         Artifact artifact = project.getArtifact();       
         try
         {
-            artifactContext.getArtifactInstaller().installArtifact( artifact, pomFile );
+            artifactContext.getArtifactInstaller().installArtifact( artifact, pomFile, true );
         }
         catch ( ArtifactInstallationException e )
         {