maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bentm...@apache.org
Subject svn commit: r803141 - /maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
Date Tue, 11 Aug 2009 14:53:13 GMT
Author: bentmann
Date: Tue Aug 11 14:53:12 2009
New Revision: 803141

URL: http://svn.apache.org/viewvc?rev=803141&view=rev
Log:
[MNG-4291] [regression] @requiresOnline mojo annotation is ignored

Modified:
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java?rev=803141&r1=803140&r2=803141&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
(original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
Tue Aug 11 14:53:12 2009
@@ -257,6 +257,23 @@
     private void execute( MavenProject project, MavenSession session, MojoExecution mojoExecution
)
         throws MojoFailureException, MojoExecutionException, PluginConfigurationException,
PluginManagerException
     {
+        MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
+
+        if ( mojoDescriptor.isOnlineRequired() && session.isOffline() )
+        {
+            if ( MojoExecution.Source.CLI.equals( mojoExecution.getSource() ) )
+            {
+                throw new MojoExecutionException( "Goal " + mojoDescriptor.getGoal()
+                    + " requires online mode for execution but Maven is currently offline."
);
+            }
+            else
+            {
+                logger.warn( "Goal " + mojoDescriptor.getGoal()
+                    + " requires online mode for execution but Maven is currently offline,
skipping" );
+                return;
+            }
+        }
+
         MavenProject executionProject = null;
 
         List<MojoExecution> forkedExecutions = mojoExecution.getForkedExecutions();
@@ -265,7 +282,7 @@
         {
             if ( logger.isDebugEnabled() )
             {
-                logger.debug( "Forking execution for " + mojoExecution.getMojoDescriptor().getId()
);
+                logger.debug( "Forking execution for " + mojoDescriptor.getId() );
             }
 
             executionProject = project.clone();
@@ -285,7 +302,7 @@
 
             if ( logger.isDebugEnabled() )
             {
-                logger.debug( "Completed forked execution for " + mojoExecution.getMojoDescriptor().getId()
);
+                logger.debug( "Completed forked execution for " + mojoDescriptor.getId()
);
             }
         }
 



Mime
View raw message