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/28 23:51:26 UTC

svn commit: r513070 - in /incubator/nmaven/branches/SI_IDE: assemblies/NMaven.Core/ assemblies/NMaven.Model/Pom/ assemblies/NMaven.Plugin.Solution/ components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/ components/dotnet-artifact/sr...

Author: sisbell
Date: Wed Feb 28 15:51:25 2007
New Revision: 513070

URL: http://svn.apache.org/viewvc?view=rev&rev=513070
Log:
No longer using modules for NMaven.Core and pom model: could not get the module type (even with dll wrapper) to work in VS and SD IDEs. This required compiling all projects as dlls and adding some additional methods to installing dependent dlls into an executable directory in the local maven repo. This solution only works local: still need a resolver for this. Otherwise, this the first fully functional version fo the IDE to pom converter.

Modified:
    incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Core/pom.xml
    incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Model/Pom/pom.xml
    incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Plugin.Solution/pom.xml
    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/InstallerMojo.java

Modified: incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Core/pom.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Core/pom.xml?view=diff&rev=513070&r1=513069&r2=513070
==============================================================================
--- incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Core/pom.xml (original)
+++ incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Core/pom.xml Wed Feb 28 15:51:25 2007
@@ -2,14 +2,14 @@
   <modelVersion>4.0.0</modelVersion>
   <groupId>NMaven.Core</groupId>
   <artifactId>NMaven.Core</artifactId>
-  <packaging>module</packaging>
+  <packaging>library</packaging>
   <version>0.14</version>
   <name>NMaven.Core</name>
   <dependencies>
     <dependency>
       <groupId>NMaven.Model</groupId>
       <artifactId>NMaven.Model.Pom</artifactId>
-      <type>module</type>
+      <type>library</type>
       <version>0.14</version>
     </dependency>
     <dependency>

Modified: incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Model/Pom/pom.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Model/Pom/pom.xml?view=diff&rev=513070&r1=513069&r2=513070
==============================================================================
--- incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Model/Pom/pom.xml (original)
+++ incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Model/Pom/pom.xml Wed Feb 28 15:51:25 2007
@@ -2,7 +2,7 @@
   <modelVersion>4.0.0</modelVersion>
   <groupId>NMaven.Model</groupId>
   <artifactId>NMaven.Model.Pom</artifactId>
-  <packaging>module</packaging>
+  <packaging>library</packaging>
   <version>0.14</version>
   <name>NMaven.Model.Pom</name>
 

Modified: incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Plugin.Solution/pom.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Plugin.Solution/pom.xml?view=diff&rev=513070&r1=513069&r2=513070
==============================================================================
--- incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Plugin.Solution/pom.xml (original)
+++ incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Plugin.Solution/pom.xml Wed Feb 28 15:51:25 2007
@@ -16,12 +16,12 @@
       <groupId>NMaven.Core</groupId>
       <artifactId>NMaven.Core</artifactId>
       <version>0.14</version>
-      <type>module</type>
+      <type>library</type>
     </dependency>
     <dependency>
       <groupId>NMaven.Model</groupId>
       <artifactId>NMaven.Model.Pom</artifactId>
-      <type>module</type>
+      <type>library</type>
       <version>0.14</version>
     </dependency>
   </dependencies>

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=513070&r1=513069&r2=513070
==============================================================================
--- 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 Wed Feb 28 15:51:25 2007
@@ -21,8 +21,10 @@
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.installer.ArtifactInstallationException;
 import org.apache.maven.project.MavenProject;
+import org.apache.maven.model.Dependency;
 
 import java.io.File;
+import java.util.List;
 
 /**
  * Provides services for installing artifacts.
@@ -79,6 +81,9 @@
      * @throws ArtifactInstallationException if there is a problem installing the artifact
      */
     void installFileWithNoPom( String groupId, String artifactId, String version, File installFile )
+        throws ArtifactInstallationException;
+
+    void installArtifactDependencies( Artifact artifact, List<Dependency> dependencies )
         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=513070&r1=513069&r2=513070
==============================================================================
--- 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 Wed Feb 28 15:51:25 2007
@@ -252,7 +252,8 @@
     }
 
     public void installFileWithNoPom( String groupId, String artifactId, String version, File installFile )
-        throws ArtifactInstallationException {
+        throws ArtifactInstallationException
+    {
         StringBuffer path = new StringBuffer();
         path.append( localRepository.getAbsolutePath() ).append( File.separator );
         for ( String id : groupId.split( "[.]" ) )
@@ -263,18 +264,56 @@
         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" );
+        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 );
+        }
+    }
+
+    public void installArtifactDependencies( Artifact projectArtifact, List<Dependency> dependencies )
+        throws ArtifactInstallationException
+    {
+        StringBuffer path = new StringBuffer();
+        path.append( localRepository.getAbsolutePath() ).append( File.separator );
+        for ( String id : projectArtifact.getGroupId().split( "[.]" ) )
+        {
+            path.append( id ).append( File.separator );
+        }
+
+        path.append( projectArtifact.getArtifactId() ).append( File.separator )
+            .append( projectArtifact.getBaseVersion() ).append( File.separator );
+
+        for ( Dependency dependency : dependencies )
+        {
+            StringBuffer depPath = new StringBuffer();
+            depPath.append( localRepository.getAbsolutePath() ).append( File.separator );
+            for ( String id : dependency.getGroupId().split( "[.]" ) )
+            {
+                depPath.append( id ).append( File.separator );
+            }
+
+            depPath.append( dependency.getArtifactId() ).append( File.separator )
+                .append( dependency.getVersion() ).append( File.separator );
+            File file = new File(
+                depPath.toString() + dependency.getArtifactId() + ".dll" ); //TODO: other types
+
             try
             {
-                FileUtils.copyFileToDirectory( installFile, new File( path.toString() ) );
+                logger.info( "NMAVEN-002-000: Installing File: From = " + file.getAbsolutePath() + ", To = " +
+                    depPath.toString() + dependency.getArtifactId() + ".dll" );
+                FileUtils.copyFileToDirectory( file, new File( path.toString() ) );
             }
             catch ( IOException e )
             {
-                throw new ArtifactInstallationException( "NMAVEN-002-015: Failed to copy artifact to local repository",
-                                                         e );
+                e.printStackTrace();
             }
+        }
     }
 
     /**

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=513070&r1=513069&r2=513070
==============================================================================
--- 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 Wed Feb 28 15:51:25 2007
@@ -26,8 +26,10 @@
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.dotnet.artifact.ArtifactContext;
 import org.apache.maven.dotnet.executable.compiler.ArtifactType;
+import org.apache.maven.model.Dependency;
 
 import java.io.File;
+import java.util.List;
 
 /**
  * @goal install
@@ -81,6 +83,20 @@
             throw new MojoExecutionException( "NMAVEN-1001-000: Failed to install artifacts", e );
         }
 
+        //To allow executables to be runnable from the repo
+        if ( artifact.getType().equals( ArtifactType.EXE.getArtifactTypeName() ) )
+        {
+            List<Dependency> dependencies = project.getDependencies();
+            try
+            {
+                artifactContext.getArtifactInstaller().installArtifactDependencies( artifact, dependencies );
+            }
+            catch ( ArtifactInstallationException e )
+            {
+                e.printStackTrace();
+            }
+        }
+
         //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" );
@@ -88,8 +104,9 @@
         {
             try
             {
-                artifactContext.getArtifactInstaller().installFileWithNoPom( artifact.getGroupId(), artifact.getArtifactId(),
-                                                                    artifact.getVersion(), linkedFile );
+                artifactContext.getArtifactInstaller().installFileWithNoPom( artifact.getGroupId(),
+                                                                             artifact.getArtifactId(),
+                                                                             artifact.getVersion(), linkedFile );
             }
             catch ( org.apache.maven.artifact.installer.ArtifactInstallationException e )
             {