1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
<?
xml
version
=
"1.0"
encoding
=
"UTF-8"
?>
xsi:schemaLocation
=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<
groupId
>com.cdai.demo</
groupId
>
<
artifactId
>hello-maven-plugin</
artifactId
>
<
version
>1.0-SNAPSHOT</
version
>
<
modelVersion
>4.0.0</
modelVersion
>
<
packaging
>maven-plugin</
packaging
>
<
name
>hello-maven-plugin</
name
>
<
properties
>
<
project.build.sourceEncoding
>UTF-8</
project.build.sourceEncoding
>
</
properties
>
<
dependencies
>
<
dependency
>
<
groupId
>org.apache.maven</
groupId
>
<
artifactId
>maven-plugin-api</
artifactId
>
<
version
>2.2.1</
version
>
</
dependency
>
</
dependencies
>
</
project
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
package
com.cdai.demo.maven;
import
org.apache.maven.plugin.AbstractMojo;
import
org.apache.maven.plugin.MojoExecutionException;
import
org.apache.maven.plugin.MojoFailureException;
/**
* Maven插件的Helloworld
* User: cdai
*
* @goal info
* @phase compile
* @requiresProject false
*/
public
class
HelloMavenPlugin
extends
AbstractMojo {
/**
* @parameter expression="${greeting}" default-value="Helloworld!!!"
*/
String greeting;
@Override
public
void
execute()
throws
MojoExecutionException, MojoFailureException {
getLog().info(greeting);
}
}
|