On 2010-02-12 11:51, Benjamin Bentmann wrote: > 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.
No I didn't. The code is pretty much the same as in the Changes Plugin and comes from a blog post [1] by Brian. That blog post was based on the Assembly plugin. [1] http://www.sonatype.com/people/2009/05/how-to-make-a-plugin-run-once-during-a-build/ > > Benjamin > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > > -- Dennis Lundberg --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
