My First MOJO PluginTibor DigaňaGithub repositoryhttps://github.com/Tibor17/maven/tree/master/plugins/firstMojo
My Mojo Pluginsample.plugin.MyMojo
Plugin Project pom.xml
Locations of files• If your plugin pom.xml is located in ${basedir},  then place the java source class  sample.plugin.MyMo...
Install plugin• cd ${basedir}• mvn install
Plugin usage in another pom.xml
Running the plugin’s goal sayhi on         another pom.xmlmvn sample.plugin:hello-maven-plugin:1.0:sayhi
Running the plugin’s goal sayhi on             another pom.xml[INFO] Scanning for projects...[INFO] ----------------------...
Running the plugin’s goal sayhi on          another pom.xml• Logger printed “Hi There!”• instead of default-value "Hello W...
Upcoming SlideShare
Loading in …5
×

My First MOJO Plugin

1,155 views

Published on

An example of Maven MOJO plugin.

Published in: Technology, News & Politics
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,155
On SlideShare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
8
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

My First MOJO Plugin

  1. 1. My First MOJO PluginTibor DigaňaGithub repositoryhttps://github.com/Tibor17/maven/tree/master/plugins/firstMojo
  2. 2. My Mojo Pluginsample.plugin.MyMojo
  3. 3. Plugin Project pom.xml
  4. 4. Locations of files• If your plugin pom.xml is located in ${basedir}, then place the java source class sample.plugin.MyMojo in to ${basedir}/src/main/java
  5. 5. Install plugin• cd ${basedir}• mvn install
  6. 6. Plugin usage in another pom.xml
  7. 7. Running the plugin’s goal sayhi on another pom.xmlmvn sample.plugin:hello-maven-plugin:1.0:sayhi
  8. 8. Running the plugin’s goal sayhi on another pom.xml[INFO] Scanning for projects...[INFO] -------------------------------------------------------------[INFO] Building my plugin usage[INFO] task-segment: [sample.plugin:hello-maven-plugin:1.0:sayhi][INFO] -------------------------------------------------------------[INFO] [hello:sayhi {execution: default-cli}][INFO] Hi There![INFO] base dir c:Userstibor17IdeaProjectsfirstMojopluginUsage[INFO] -------------------------------------------------------------[INFO] BUILD SUCCESSFUL[INFO] -------------------------------------------------------------[INFO] Total time: < 1 second[INFO] Finished at: Fri Jun 15 13:47:40 CEST 2012[INFO] Final Memory: 2M/15M[INFO] -------------------------------------------------------------
  9. 9. Running the plugin’s goal sayhi on another pom.xml• Logger printed “Hi There!”• instead of default-value "Hello World!“• See the field “greeting” in MyMojo class

×