diff --git a/maven-plugins/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java b/maven-plugins/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java index c96211a5bb..a34e804214 100644 --- a/maven-plugins/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java +++ b/maven-plugins/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java @@ -60,6 +60,11 @@ public void setProject( MavenProject project ) public void execute() throws MojoExecutionException { + if ( project.getFile() == null || !project.getFile().exists() ) + { + throw new MojoExecutionException( "There must be a POM in the current working directory for the Eclipse plugin to work." ); + } + try { eclipseWriter.write( project ); diff --git a/maven-plugins/maven-eclipse-plugin/src/test/projects/project-1/.classpath b/maven-plugins/maven-eclipse-plugin/src/test/projects/project-1/.classpath index e1b10830c5..1d941a2d3d 100644 --- a/maven-plugins/maven-eclipse-plugin/src/test/projects/project-1/.classpath +++ b/maven-plugins/maven-eclipse-plugin/src/test/projects/project-1/.classpath @@ -2,5 +2,5 @@ - + \ No newline at end of file diff --git a/maven-plugins/maven-eclipse-plugin/src/test/projects/project-2/.classpath b/maven-plugins/maven-eclipse-plugin/src/test/projects/project-2/.classpath index 65275a7070..693dd3ca71 100644 --- a/maven-plugins/maven-eclipse-plugin/src/test/projects/project-2/.classpath +++ b/maven-plugins/maven-eclipse-plugin/src/test/projects/project-2/.classpath @@ -5,5 +5,5 @@ - + \ No newline at end of file