Author: sisbell Date: Mon Feb 26 10:04:52 2007 New Revision: 511935 URL: http://svn.apache.org/viewvc?view=rev&rev=511935 Log: Fixed artifact installer to handle GAC: it removes the GAC dependency before installing into local repo.
Modified: incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/ArtifactInstallerImpl.java Modified: incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/ArtifactInstallerImpl.java URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/ArtifactInstallerImpl.java?view=diff&rev=511935&r1=511934&r2=511935 ============================================================================== --- incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/ArtifactInstallerImpl.java (original) +++ incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/ArtifactInstallerImpl.java Mon Feb 26 10:04:52 2007 @@ -24,6 +24,7 @@ import org.apache.maven.dotnet.artifact.ApplicationConfig; import org.apache.maven.project.MavenProject; import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.resolver.filter.ArtifactFilter; import org.apache.maven.artifact.metadata.ArtifactMetadata; import org.apache.maven.artifact.factory.ArtifactFactory; import org.apache.maven.artifact.installer.ArtifactInstallationException; @@ -45,6 +46,7 @@ import java.io.FileReader; import java.util.List; import java.util.ArrayList; +import java.util.Collections; /** * Provides an implementation of the <code>ArtifactInstaller</code> interface. @@ -121,6 +123,18 @@ ApplicationConfig applicationConfig = artifactContext.getApplicationConfigFor( artifact ); 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 + { + artifact.addMetadata( createArtifactMetadataFor( artifact, pomFile, project.getDependencies() ) ); + } + catch ( IOException e ) + { + throw new ArtifactInstallationException( "NMAVEN-002-001: Unable to add metadata to artifact", e ); + } + //End GAC HACK + if ( configExeFile.exists() ) { logger.info( "NMAVEN-002-000: Found config executable: File = " + configExeFile.getAbsolutePath() ); @@ -343,10 +357,21 @@ e.printStackTrace(); throw new IOException( "NMAVEN-002-013: Unable to read pom file" ); } + List<Dependency> dest = new ArrayList<Dependency>(); + dest.addAll( model.getDependencies()); + for ( Dependency dependency : dest ) + { + model.removeDependency( dependency ); + } for ( Dependency dependency : dependencies ) { - model.addDependency( dependency ); + //TODO: This condition is only here since transitive gac dependencies break the build. This needs to be fixed + //within the core. + if ( !dependency.getType().equals( "gac" ) ) + { + model.addDependency( dependency ); + } } File tempFile = File.createTempFile( "mvninstall", ".pom" );