make mojos backwards compat with alpha-2, and run with the eclipse test unmodified

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@191579 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-06-20 22:35:26 +00:00
parent d7e421fd01
commit 046dc5d63c
3 changed files with 15 additions and 9 deletions

View File

@ -28,7 +28,7 @@
* *
* @goal eclipse * @goal eclipse
* @requiresDependencyResolution test * @requiresDependencyResolution test
* @execute phase="generate-sources" * @executePhase="generate-sources"
* *
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a> * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
* @version $Id$ * @version $Id$
@ -47,10 +47,7 @@ public class EclipsePlugin
private MavenProject project; private MavenProject project;
/** /**
* The project whose project files to create.
*
* @parameter expression="${executedProject}" * @parameter expression="${executedProject}"
* @required
*/ */
private MavenProject executedProject; private MavenProject executedProject;
@ -94,6 +91,12 @@ public void execute()
{ {
eclipseWriter.setLocalRepositoryFile( new File ( localRepository.getBasedir() ) ); eclipseWriter.setLocalRepositoryFile( new File ( localRepository.getBasedir() ) );
if ( executedProject == null )
{
// backwards compat with alpha-2 only
executedProject = project;
}
eclipseWriter.write( project, executedProject ); eclipseWriter.write( project, executedProject );
} }
catch ( EclipsePluginException e ) catch ( EclipsePluginException e )

View File

@ -40,7 +40,7 @@
* Goal for generating IDEA files from a POM. * Goal for generating IDEA files from a POM.
* *
* @goal idea * @goal idea
* @execute phase="generate-sources" * @executePhase "generate-sources"
* @requiresDependencyResolution test * @requiresDependencyResolution test
* @todo use dom4j or something. Xpp3Dom can't cope properly with entities and so on * @todo use dom4j or something. Xpp3Dom can't cope properly with entities and so on
*/ */
@ -56,14 +56,18 @@ public class IdeaMojo
/** /**
* @parameter expression="${executedProject}" * @parameter expression="${executedProject}"
* @required
* @readonly
*/ */
private MavenProject executedProject; private MavenProject executedProject;
public void execute() public void execute()
throws MojoExecutionException throws MojoExecutionException
{ {
if ( executedProject == null )
{
// backwards compat with alpha-2 only
executedProject = project;
}
rewriteModule(); rewriteModule();
rewriteProject(); rewriteProject();

View File

@ -90,8 +90,7 @@
<module>maven-clean-plugin</module> <module>maven-clean-plugin</module>
<module>maven-compiler-plugin</module> <module>maven-compiler-plugin</module>
<module>maven-deploy-plugin</module> <module>maven-deploy-plugin</module>
<!-- Broken reference to ${executedProject} --> <module>maven-eclipse-plugin</module>
<!-- module>maven-eclipse-plugin</module -->
<module>maven-ejb-plugin</module> <module>maven-ejb-plugin</module>
<module>maven-idea-plugin</module> <module>maven-idea-plugin</module>
<module>maven-install-plugin</module> <module>maven-install-plugin</module>