directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r985272 - in /directory/studio-plugin/trunk/src/main/java/org/apache/directory/studio/maven/plugins: AbstractStudioMojo.java StudioCleanMojo.java StudioEclipseMojo.java
Date Fri, 13 Aug 2010 16:35:50 GMT
Author: pamarcelot
Date: Fri Aug 13 16:35:50 2010
New Revision: 985272

URL: http://svn.apache.org/viewvc?rev=985272&view=rev
Log:
Added propagation of active profiles in forked Maven goals.

Modified:
    directory/studio-plugin/trunk/src/main/java/org/apache/directory/studio/maven/plugins/AbstractStudioMojo.java
    directory/studio-plugin/trunk/src/main/java/org/apache/directory/studio/maven/plugins/StudioCleanMojo.java
    directory/studio-plugin/trunk/src/main/java/org/apache/directory/studio/maven/plugins/StudioEclipseMojo.java

Modified: directory/studio-plugin/trunk/src/main/java/org/apache/directory/studio/maven/plugins/AbstractStudioMojo.java
URL: http://svn.apache.org/viewvc/directory/studio-plugin/trunk/src/main/java/org/apache/directory/studio/maven/plugins/AbstractStudioMojo.java?rev=985272&r1=985271&r2=985272&view=diff
==============================================================================
--- directory/studio-plugin/trunk/src/main/java/org/apache/directory/studio/maven/plugins/AbstractStudioMojo.java
(original)
+++ directory/studio-plugin/trunk/src/main/java/org/apache/directory/studio/maven/plugins/AbstractStudioMojo.java
Fri Aug 13 16:35:50 2010
@@ -38,6 +38,7 @@ import org.apache.maven.artifact.resolve
 import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
 import org.apache.maven.artifact.versioning.VersionRange;
 import org.apache.maven.model.Dependency;
+import org.apache.maven.model.Profile;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.project.MavenProject;
@@ -232,7 +233,7 @@ public abstract class AbstractStudioMojo
      * @throws MavenExecutorException
      * @throws CommandLineException
      */
-    protected int forkMvnGoal( final String goal ) throws MavenExecutorException, CommandLineException
+    protected int forkMvnGoal( final String goal, List profiles ) throws MavenExecutorException,
CommandLineException
     {
         CommandLineFactory commandLineFactory = new DefaultCommandLineFactory();
         Commandline cl = commandLineFactory.createCommandLine( "mvn" );
@@ -243,6 +244,26 @@ public abstract class AbstractStudioMojo
         cl.createArg().setValue( goal );
         cl.createArg().setValue( "--no-plugin-updates" );
         cl.createArg().setValue( "--batch-mode" );
+
+        // Profiles ("-Pxxx") argument
+        if ( ( profiles != null ) && ( profiles.size() > 0 ) )
+        {
+            StringBuilder sb = new StringBuilder();
+            sb.append( "-P" );
+            for ( Object profileObject : profiles )
+            {
+                if ( profileObject instanceof Profile )
+                {
+                    Profile profile = ( Profile ) profileObject;
+                    sb.append( profile.getId() );
+                    sb.append( ',' );
+                }
+            }
+            sb.deleteCharAt( sb.length() - 1 );
+
+            cl.createArg().setValue( sb.toString() );
+        }
+
         TeeOutputStream stdOut = new TeeOutputStream( System.out );
         TeeOutputStream stdErr = new TeeOutputStream( System.err );
         return ForkedMavenExecutor.executeCommandLine( cl, System.in, stdOut, stdErr );

Modified: directory/studio-plugin/trunk/src/main/java/org/apache/directory/studio/maven/plugins/StudioCleanMojo.java
URL: http://svn.apache.org/viewvc/directory/studio-plugin/trunk/src/main/java/org/apache/directory/studio/maven/plugins/StudioCleanMojo.java?rev=985272&r1=985271&r2=985272&view=diff
==============================================================================
--- directory/studio-plugin/trunk/src/main/java/org/apache/directory/studio/maven/plugins/StudioCleanMojo.java
(original)
+++ directory/studio-plugin/trunk/src/main/java/org/apache/directory/studio/maven/plugins/StudioCleanMojo.java
Fri Aug 13 16:35:50 2010
@@ -50,7 +50,7 @@ public class StudioCleanMojo extends Abs
         {
             try
             {
-                forkMvnGoal( "eclipse:clean" );
+                forkMvnGoal( "eclipse:clean", project.getActiveProfiles() );
             }
             catch ( Exception e )
             {

Modified: directory/studio-plugin/trunk/src/main/java/org/apache/directory/studio/maven/plugins/StudioEclipseMojo.java
URL: http://svn.apache.org/viewvc/directory/studio-plugin/trunk/src/main/java/org/apache/directory/studio/maven/plugins/StudioEclipseMojo.java?rev=985272&r1=985271&r2=985272&view=diff
==============================================================================
--- directory/studio-plugin/trunk/src/main/java/org/apache/directory/studio/maven/plugins/StudioEclipseMojo.java
(original)
+++ directory/studio-plugin/trunk/src/main/java/org/apache/directory/studio/maven/plugins/StudioEclipseMojo.java
Fri Aug 13 16:35:50 2010
@@ -94,13 +94,14 @@ public class StudioEclipseMojo extends A
      */
     protected boolean createManifest;
 
+
     public void execute() throws MojoExecutionException
     {
         if ( project.isExecutionRoot() )
         {
             try
             {
-                forkMvnGoal( "eclipse:eclipse" );
+                forkMvnGoal( "eclipse:eclipse", project.getActiveProfiles() );
             }
             catch ( Exception e )
             {
@@ -141,7 +142,7 @@ public class StudioEclipseMojo extends A
         {
             try
             {
-                forkMvnGoal( "bundle:manifest" );
+                forkMvnGoal( "bundle:manifest", project.getActiveProfiles() );
             }
             catch ( Exception e )
             {
@@ -208,16 +209,18 @@ public class StudioEclipseMojo extends A
             {
                 entry = new Xpp3Dom( "classpathentry" );
                 entry.setAttribute( "kind", "lib" );
-                entry.setAttribute( "path", ( new StringBuilder() ).append( libraryPath ).append(
'/' ).append(
-                    artifact.getFile().getName() ).toString() );
+                entry.setAttribute( "path",
+                    ( new StringBuilder() ).append( libraryPath ).append( '/' ).append( artifact.getFile().getName()
)
+                        .toString() );
             }
             else
             {
                 entry = new Xpp3Dom( "classpathentry" );
                 entry.setAttribute( "exported", "true" );
                 entry.setAttribute( "kind", "lib" );
-                entry.setAttribute( "path", ( new StringBuilder() ).append( libraryPath ).append(
'/' ).append(
-                    artifact.getFile().getName() ).toString() );
+                entry.setAttribute( "path",
+                    ( new StringBuilder() ).append( libraryPath ).append( '/' ).append( artifact.getFile().getName()
)
+                        .toString() );
             }
             dom.addChild( entry );
         }



Mime
View raw message