Skip to content

Commit 54e7a6c

Browse files
committed
[MECLIPSE-758] Use mojo annotations
Patch of Joseph Walton applied. git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk@1672305 13f79535-47bb-0310-9956-ffa450edef68
1 parent 679f521 commit 54e7a6c

13 files changed

Lines changed: 150 additions & 232 deletions

pom.xml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ under the License.
7676
<artifactId>maven-plugin-api</artifactId>
7777
<version>${mavenVersion}</version>
7878
</dependency>
79+
<dependency>
80+
<groupId>org.apache.maven.plugin-tools</groupId>
81+
<artifactId>maven-plugin-annotations</artifactId>
82+
<scope>provided</scope>
83+
</dependency>
7984
<dependency>
8085
<groupId>org.apache.maven</groupId>
8186
<artifactId>maven-model</artifactId>
@@ -282,10 +287,9 @@ under the License.
282287
</pluginManagement>
283288
<plugins>
284289
<plugin>
285-
<!-- lock down to old version as newer version aborts build upon no mojos as required during ITs, see FIXME below -->
286290
<groupId>org.apache.maven.plugins</groupId>
287291
<artifactId>maven-plugin-plugin</artifactId>
288-
<version>2.4.3</version>
292+
<version>3.4</version>
289293
</plugin>
290294
<plugin>
291295
<artifactId>maven-enforcer-plugin</artifactId>

src/main/java/org/apache/maven/plugin/eclipse/AbstractWorkspaceMojo.java

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,19 @@
2020

2121
import org.apache.maven.artifact.repository.ArtifactRepository;
2222
import org.apache.maven.plugin.AbstractMojo;
23+
import org.apache.maven.plugins.annotations.Parameter;
2324

24-
/**
25-
* @requiresProject true
26-
*/
2725
public abstract class AbstractWorkspaceMojo
2826
extends AbstractMojo
2927
{
3028

3129
/**
3230
* Directory location of the <code>Eclipse</code> workspace.
33-
*
34-
* @parameter expression="${eclipse.workspace}"
35-
* @required
3631
*/
32+
@Parameter( property = "eclipse.workspace", required = true )
3733
private String workspace;
3834

39-
/**
40-
* @parameter expression="${localRepository}"
41-
* @required
42-
* @readonly
43-
*/
35+
@Parameter( property = "localRepository", required = true, readonly = true )
4436
private ArtifactRepository localRepository;
4537

4638
public ArtifactRepository getLocalRepository()

src/main/java/org/apache/maven/plugin/eclipse/ConfigureWorkspaceMojo.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,33 +20,31 @@
2020

2121
import org.apache.maven.plugin.MojoExecutionException;
2222
import org.apache.maven.plugin.eclipse.writers.workspace.EclipseWorkspaceWriter;
23+
import org.apache.maven.plugins.annotations.Mojo;
24+
import org.apache.maven.plugins.annotations.Parameter;
2325

2426
/**
2527
* Configures The following Eclipse Workspace features:
2628
* <ul>
2729
* <li>Adds the classpath variable MAVEN_REPO to Eclipse.</li>
2830
* <li>Optionally load Eclipse code style file via a URL.</li>
2931
* </ul>
30-
*
31-
* @goal configure-workspace
32-
* @requiresProject false
3332
*/
33+
@Mojo( name = "configure-workspace", requiresProject = false )
3434
public class ConfigureWorkspaceMojo
3535
extends AbstractWorkspaceMojo
3636
{
3737
/**
3838
* Point to a URL containing code styles content.
39-
*
40-
* @parameter expression="${eclipse.workspaceCodeStylesURL}"
4139
*/
40+
@Parameter( property = "eclipse.workspaceCodeStylesURL" )
4241
private String workspaceCodeStylesURL;
4342

4443
/**
4544
* Name of a profile in <code>workspaceCodeStylesURL</code> to activate. Default is the first profile name in the
4645
* code style file in <code>workspaceCodeStylesURL</code>
47-
*
48-
* @parameter expression="${eclipse.workspaceActiveCodeStyleProfileName}"
4946
*/
47+
@Parameter( property = "eclipse.workspaceActiveCodeStyleProfileName" )
5048
private String workspaceActiveCodeStyleProfileName;
5149

5250
public void execute()

src/main/java/org/apache/maven/plugin/eclipse/EclipseCleanMojo.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@
2222
import org.apache.maven.plugin.MojoExecutionException;
2323
import org.apache.maven.plugin.eclipse.writers.workspace.EclipseWorkspaceWriter;
2424
import org.apache.maven.plugin.ide.IdeUtils;
25+
import org.apache.maven.plugins.annotations.Mojo;
26+
import org.apache.maven.plugins.annotations.Parameter;
2527

2628
import java.io.File;
2729

2830
/**
2931
* Deletes the .project, .classpath, .wtpmodules files and .settings folder used by Eclipse.
30-
*
31-
* @goal clean
3232
*/
33+
@Mojo( name = "clean" )
3334
public class EclipseCleanMojo
3435
extends AbstractMojo
3536
{
@@ -51,30 +52,26 @@ public class EclipseCleanMojo
5152

5253
/**
5354
* Packaging for the current project.
54-
*
55-
* @parameter expression="${project.packaging}"
5655
*/
56+
@Parameter( property = "project.packaging" )
5757
private String packaging;
5858

5959
/**
6060
* The root directory of the project
61-
*
62-
* @parameter expression="${basedir}"
6361
*/
62+
@Parameter( property = "basedir" )
6463
private File basedir;
6564

6665
/**
6766
* Skip the operation when true.
68-
*
69-
* @parameter expression="${eclipse.skip}" default-value="false"
7067
*/
68+
@Parameter( property = "eclipse.skip", defaultValue = "false" )
7169
private boolean skip;
7270

7371
/**
7472
* additional generic configuration files for eclipse
75-
*
76-
* @parameter
7773
*/
74+
@Parameter
7875
private EclipseConfigFile[] additionalConfig;
7976

8077
/**

0 commit comments

Comments
 (0)