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/02/27 20:02:54 UTC
svn commit: r512377 - in /incubator/nmaven/branches/SI_IDE:
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...
Author: sisbell
Date: Tue Feb 27 12:02:53 2007
New Revision: 512377
URL: http://svn.apache.org/viewvc?view=rev&rev=512377
Log:
Added ability to install a file (without meta-data) into the local repo. This is needed to install the dll wrapper for netmodules, so that the IDE can reference the assemblies.
Modified:
incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/ArtifactInstaller.java
incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/ArtifactInstallerImpl.java
incubator/nmaven/branches/SI_IDE/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/FileInstallerMojo.java
incubator/nmaven/branches/SI_IDE/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/InstallerMojo.java
Modified: incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/ArtifactInstaller.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/ArtifactInstaller.java?view=diff&rev=512377&r1=512376&r2=512377
==============================================================================
--- incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/ArtifactInstaller.java (original)
+++ incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/ArtifactInstaller.java Tue Feb 27 12:02:53 2007
@@ -42,7 +42,7 @@
* will also check whether an exe.config file is associated with the artifact and install the exe.config into
* the local maven repository. This will allow installed artifacts, with their associated configuration information,
* to be directly executed from the local maven repository.
- *
+ * <p/>
* Typically the artifact parameter will be obtained directly through the maven project:
* <code>MavenProject.getArtifact</code>. In those cases where the MavenProject object is unavailable, then
* you can use the <code>installFile</code> method from this interface.
@@ -66,6 +66,19 @@
* @throws ArtifactInstallationException if there is a problem installing the artifact
*/
void installFile( String groupId, String artifactId, String version, String packaging, File pomFile )
+ throws ArtifactInstallationException;
+
+ /**
+ * Installs a file into the local maven repository, without generating a pom.xml. This is used for placing
+ * files and resources into the local repository, where there are no explicit dependencies (as given in the pom file).
+ *
+ * @param groupId the group id of the file to install
+ * @param artifactId the artifact id of the file to install
+ * @param version the version of the file to install
+ * @param installFile the file to install
+ * @throws ArtifactInstallationException if there is a problem installing the artifact
+ */
+ void installFileWithNoPom( String groupId, String artifactId, String version, File installFile )
throws ArtifactInstallationException;
/**
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=512377&r1=512376&r2=512377
==============================================================================
--- 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 Tue Feb 27 12:02:53 2007
@@ -24,7 +24,6 @@
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;
@@ -46,7 +45,6 @@
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.
@@ -129,9 +127,9 @@
{
List<Dependency> dependencies = project.getDependencies();
List<Dependency> newDependencies = new ArrayList<Dependency>();
- for(Dependency dependency : dependencies)
+ for ( Dependency dependency : dependencies )
{
- if(!dependency.getType().equals("gac"))
+ if ( !dependency.getType().equals( "gac" ) )
{
newDependencies.add( dependency );
}
@@ -187,6 +185,15 @@
if ( artifact.getFile() != null && artifact.getFile().exists() )//maybe just a test compile and no install
{
mavenInstaller.install( artifact.getFile(), artifact, artifactRepository );
+ //Installing Linked file for IDE:
+ /*
+ File linkedFile =
+ new File( artifact.getFile().getParent() + File.separatorChar + artifact.getArtifactId() + ".dll" );
+ if ( artifact.getType().equals( "module" ) && linkedFile.exists() )
+ {
+ mavenInstaller.install( linkedFile, artifact, artifactRepository );
+ }
+ */
}
}
catch ( ArtifactInstallationException e )
@@ -244,6 +251,32 @@
}
+ public void installFileWithNoPom( String groupId, String artifactId, String version, File installFile )
+ throws ArtifactInstallationException {
+ StringBuffer path = new StringBuffer();
+ path.append( localRepository.getAbsolutePath() ).append( File.separator );
+ for ( String id : groupId.split( "[.]" ) )
+ {
+ path.append( id ).append( File.separator );
+ }
+
+ path.append( artifactId ).append( File.separator )
+ .append( version ).append( File.separator );
+
+ logger.info( "NMAVEN-002-014: Installing File: From = " +
+ installFile.getAbsolutePath() + ", To = " + path.toString() + artifactId +
+ ".dll" );
+ try
+ {
+ FileUtils.copyFileToDirectory( installFile, new File( path.toString() ) );
+ }
+ catch ( IOException e )
+ {
+ throw new ArtifactInstallationException( "NMAVEN-002-015: Failed to copy artifact to local repository",
+ e );
+ }
+ }
+
/**
* @see org.apache.maven.dotnet.artifact.ArtifactInstaller#installNetModulesToTargetDirectory(org.apache.maven.artifact.Artifact)
*/
@@ -368,7 +401,7 @@
throw new IOException( "NMAVEN-002-013: Unable to read pom file" );
}
List<Dependency> dest = new ArrayList<Dependency>();
- dest.addAll( model.getDependencies());
+ dest.addAll( model.getDependencies() );
for ( Dependency dependency : dest )
{
model.removeDependency( dependency );
Modified: incubator/nmaven/branches/SI_IDE/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/FileInstallerMojo.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_IDE/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/FileInstallerMojo.java?view=diff&rev=512377&r1=512376&r2=512377
==============================================================================
--- incubator/nmaven/branches/SI_IDE/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/FileInstallerMojo.java (original)
+++ incubator/nmaven/branches/SI_IDE/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/FileInstallerMojo.java Tue Feb 27 12:02:53 2007
@@ -94,16 +94,6 @@
public void execute()
throws MojoExecutionException
{
- try
- {
- nmavenRegistry.createRepositoryRegistry();
- }
- catch ( IOException e )
- {
- throw new MojoExecutionException(
- "NMAVEN-1000-001: Failed to create the repository registry for this plugin", e );
- }
-
artifactContext.init( project, localRepository );
try
{
Modified: incubator/nmaven/branches/SI_IDE/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/InstallerMojo.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_IDE/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/InstallerMojo.java?view=diff&rev=512377&r1=512376&r2=512377
==============================================================================
--- incubator/nmaven/branches/SI_IDE/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/InstallerMojo.java (original)
+++ incubator/nmaven/branches/SI_IDE/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/InstallerMojo.java Tue Feb 27 12:02:53 2007
@@ -23,7 +23,9 @@
import org.apache.maven.project.MavenProject;
import org.apache.maven.artifact.installer.ArtifactInstaller;
import org.apache.maven.artifact.installer.ArtifactInstallationException;
+import org.apache.maven.artifact.Artifact;
import org.apache.maven.dotnet.artifact.ArtifactContext;
+import org.apache.maven.dotnet.executable.compiler.ArtifactType;
import java.io.File;
@@ -69,13 +71,31 @@
public void execute()
throws MojoExecutionException
{
+ Artifact artifact = project.getArtifact();
try
{
- artifactContext.getArtifactInstaller().installArtifact( project.getArtifact(), pomFile );
+ artifactContext.getArtifactInstaller().installArtifact( artifact, pomFile );
}
catch ( ArtifactInstallationException e )
{
throw new MojoExecutionException( "NMAVEN-1001-000: Failed to install artifacts", e );
}
+
+ //For the IDE: If we see a dll with same name as netmodule, copy dll to the local repo.
+ File linkedFile =
+ new File( artifact.getFile().getParent() + File.separatorChar + artifact.getArtifactId() + ".dll" );
+ if ( linkedFile.exists() && artifact.getType().equals( ArtifactType.MODULE.getArtifactTypeName() ) )
+ {
+ try
+ {
+ artifactContext.getArtifactInstaller().installFileWithNoPom( artifact.getGroupId(), artifact.getArtifactId(),
+ artifact.getVersion(), linkedFile );
+ }
+ catch ( org.apache.maven.artifact.installer.ArtifactInstallationException e )
+ {
+ throw new MojoExecutionException( "NMAVEN-1001-001: Failed to install artifact file", e );
+ }
+ }
+
}
}