Hi Dennis,
Revision
11887 <http://fisheye.codehaus.org/changelog/mojo/?cs=11887>
Author
dennisl
Date
2010-02-12 04:13:13 -0600 (Fri, 12 Feb 2010)
Log Message
[MBUILDHELPER-18
<http://jira.codehaus.org/secure/ViewIssue.jspa?key=MBUILDHELPER-18>] Make it
possible to run the attach-artifact goal only at the root of a multi-module project
+
+ /**
+ * Returns <code>true</code> if the current project is located at the
+ * Execution Root Directory (where mvn was launched).
+ *
+ * @return <code>true</code> if the current project is at the Execution
Root
+ */
+ private boolean isThisTheExecutionRoot()
+ {
+ getLog().debug( "Root Folder:" +
mavenSession.getExecutionRootDirectory() );
+ getLog().debug( "Current Folder:" + basedir );
+ boolean result =
mavenSession.getExecutionRootDirectory().equalsIgnoreCase( basedir.toString() );
+ if ( result )
+ {
+ getLog().debug( "This is the execution root." );
+ }
+ else
+ {
+ getLog().debug( "This is NOT the execution root." );
+ }
+ return result;
+ }
Did you try the one liner
MavenProject.isExecutionRoot()
? Apart from its simplicity, this should also work properly for a Maven
invocation like
mvn -f dir/pom.xml
where the session's root directory does not match the project base
directory.
Benjamin
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email