<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mojo Archives - scmGalaxy</title>
	<atom:link href="https://www.scmgalaxy.com/tutorials/tag/mojo/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.scmgalaxy.com/tutorials/tag/mojo/</link>
	<description>A Platform for Software Engineers</description>
	<lastBuildDate>Sat, 21 Feb 2026 07:13:16 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1</generator>
	<item>
		<title>Understanding Maven Plugin Annotations: A Developer’s Guide</title>
		<link>https://www.scmgalaxy.com/tutorials/understanding-maven-plugin-annotations-a-developers-guide/</link>
					<comments>https://www.scmgalaxy.com/tutorials/understanding-maven-plugin-annotations-a-developers-guide/#respond</comments>
		
		<dc:creator><![CDATA[Vijay K]]></dc:creator>
		<pubDate>Thu, 24 Apr 2025 05:39:25 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[BuildAutomation]]></category>
		<category><![CDATA[DevOpsTools]]></category>
		<category><![CDATA[JavaAnnotations]]></category>
		<category><![CDATA[MavenPluginDevelopment]]></category>
		<category><![CDATA[Mojo]]></category>
		<category><![CDATA[StepByStepGuide]]></category>
		<guid isPermaLink="false">https://www.scmgalaxy.com/tutorials/?p=12136</guid>

					<description><![CDATA[<p>Apache Maven is a powerful tool for project management and build automation. When developing custom Maven plugins, Maven Plugin Annotations [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/understanding-maven-plugin-annotations-a-developers-guide/">Understanding Maven Plugin Annotations: A Developer’s Guide</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image size-full"><img fetchpriority="high" decoding="async" width="1016" height="407" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/04/image-13.png" alt="" class="wp-image-12137" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/04/image-13.png 1016w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/04/image-13-300x120.png 300w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/04/image-13-768x308.png 768w" sizes="(max-width: 1016px) 100vw, 1016px" /></figure>



<p class="wp-block-paragraph">Apache Maven is a powerful tool for project management and build automation. When developing custom Maven plugins, <strong>Maven Plugin Annotations</strong> simplify and standardize how plugin metadata and configurations are defined. This guide provides a deep dive into what Maven Plugin Annotations are, how they work, and how you can get started using them.</p>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f50d.png" alt="🔍" class="wp-smiley" style="height: 1em; max-height: 1em;" /> What is Maven-Plugin-Annotations?</h2>



<p class="wp-block-paragraph"><strong>Maven Plugin Annotations</strong> are part of the <code>org.apache.maven.plugin-tools</code> suite, specifically the <code>maven-plugin-annotations</code> artifact. These annotations are used to <strong>simplify the creation of Maven plugins</strong> by replacing verbose and error-prone plugin descriptor XML (<code>plugin.xml</code>) files with clean, declarative Java annotations.</p>



<p class="wp-block-paragraph">These annotations are processed during build time by the <strong>Maven Plugin Tools API</strong>, which automatically generates the necessary plugin descriptor (<code>META-INF/maven/plugin.xml</code>) for your plugin.</p>



<h3 class="wp-block-heading">Key Annotations:</h3>



<ul class="wp-block-list">
<li><code>@Mojo</code>: Declares a goal (like <code>compile</code>, <code>clean</code>) of a Maven plugin.</li>



<li><code>@Parameter</code>: Defines configuration parameters for the Mojo.</li>



<li><code>@Component</code>: Injects shared Maven components.</li>



<li><code>@Execute</code>: Controls plugin execution phase or goal dependency.</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f4a1.png" alt="💡" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Major Use Cases of Maven Plugin Annotations</h2>



<h3 class="wp-block-heading">1. <strong>Developing Custom Maven Plugins</strong></h3>



<p class="wp-block-paragraph">Annotations provide a cleaner and faster way to define plugin goals and parameters without manually writing XML descriptors.</p>



<h3 class="wp-block-heading">2. <strong>Automating Build Tasks</strong></h3>



<p class="wp-block-paragraph">You can create plugins for code generation, packaging, compilation steps, versioning, testing, or deployment.</p>



<h3 class="wp-block-heading">3. <strong>Reusable DevOps Tools</strong></h3>



<p class="wp-block-paragraph">Create reusable internal tools or DevOps pipelines using custom Maven plugins.</p>



<h3 class="wp-block-heading">4. <strong>Simplified Metadata Configuration</strong></h3>



<p class="wp-block-paragraph">Replace verbose XML with readable, maintainable Java code, improving team productivity.</p>



<h3 class="wp-block-heading">5. <strong>Enhanced Integration</strong></h3>



<p class="wp-block-paragraph">Annotations allow smooth integration with Maven&#8217;s lifecycle and improve compatibility with Maven’s Plugin Descriptor Generator.</p>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f6e0.png" alt="🛠" class="wp-smiley" style="height: 1em; max-height: 1em;" /> How Maven Plugin Annotations Work (with Architecture)</h2>



<figure class="wp-block-image size-full"><img decoding="async" width="1007" height="588" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/04/image-14.png" alt="" class="wp-image-12138" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/04/image-14.png 1007w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/04/image-14-300x175.png 300w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/04/image-14-768x448.png 768w" sizes="(max-width: 1007px) 100vw, 1007px" /></figure>



<p class="wp-block-paragraph">Maven Plugin Annotations work as a bridge between Java code and Maven’s plugin system. Here’s a high-level overview of how they work:</p>



<h3 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f3d7.png" alt="🏗" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Architecture Overview:</h3>



<ol class="wp-block-list">
<li><strong>Java Mojo with Annotations</strong><br>You define your plugin logic in a Java class and annotate it with <code>@Mojo</code>, <code>@Parameter</code>, etc.</li>



<li><strong>Annotation Processing via Plugin Tools</strong><br>During build time, <code>maven-plugin-plugin</code> uses the <code>maven-plugin-annotations</code> and scans the annotations in your code.</li>



<li><strong>Descriptor Generation</strong><br>A <code>plugin.xml</code> file is automatically created in <code>META-INF/maven/</code>, defining the plugin&#8217;s goals, configuration, and dependencies.</li>



<li><strong>Plugin Deployment</strong><br>You install/deploy the plugin to a repository and invoke it using standard Maven commands.</li>



<li><strong>Plugin Execution</strong><br>When the plugin is used in another project, Maven invokes the annotated logic via the standard Mojo interface.</li>
</ol>



<h3 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2611.png" alt="☑" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Example:</h3>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
@Mojo(name = &quot;greet&quot;, defaultPhase = LifecyclePhase.PACKAGE)
public class GreetMojo extends AbstractMojo {

    @Parameter(property = &quot;greet.name&quot;, defaultValue = &quot;Developer&quot;)
    private String name;

    public void execute() {
        getLog().info(&quot;Hello, &quot; + name + &quot;!&quot;);
    }
}

</pre></div>


<p class="wp-block-paragraph">This plugin prints a greeting during the <code>package</code> phase.</p>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f504.png" alt="🔄" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Basic Workflow of Maven Plugin Annotations</h2>



<ol class="wp-block-list">
<li><strong>Define a Mojo class extending <code>AbstractMojo</code>.</strong></li>



<li><strong>Use <code>@Mojo</code> to register the goal name.</strong></li>



<li><strong>Declare inputs using <code>@Parameter</code>.</strong></li>



<li><strong>Optionally use <code>@Component</code> to inject Maven internals (e.g., <code>MavenProject</code>).</strong></li>



<li><strong>Build using <code>maven-plugin-plugin</code> to generate <code>plugin.xml</code>.</strong></li>



<li><strong>Install or deploy the plugin to your Maven repository.</strong></li>



<li><strong>Use the plugin in other projects via <code>pom.xml</code>.</strong></li>
</ol>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f680.png" alt="🚀" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Step-by-Step Getting Started Guide</h2>



<h3 class="wp-block-heading">Step 1: Setup Your Project</h3>



<p class="wp-block-paragraph">Create a new Maven project for the plugin:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
mvn archetype:generate 
  -DgroupId=com.example.plugins 
  -DartifactId=custom-maven-plugin 
  -DarchetypeArtifactId=maven-archetype-plugin

</pre></div>


<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 class="wp-block-heading">Step 2: Add Required Dependencies</h3>



<p class="wp-block-paragraph">In <code>pom.xml</code>, include:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
&amp;lt;build&amp;gt;
  &amp;lt;plugins&amp;gt;
    &amp;lt;plugin&amp;gt;
      &amp;lt;groupId&amp;gt;org.apache.maven.plugins&amp;lt;/groupId&amp;gt;
      &amp;lt;artifactId&amp;gt;maven-plugin-plugin&amp;lt;/artifactId&amp;gt;
      &amp;lt;version&amp;gt;3.9.0&amp;lt;/version&amp;gt;
      &amp;lt;executions&amp;gt;
        &amp;lt;execution&amp;gt;
          &amp;lt;goals&amp;gt;
            &amp;lt;goal&amp;gt;descriptor&amp;lt;/goal&amp;gt;
          &amp;lt;/goals&amp;gt;
        &amp;lt;/execution&amp;gt;
      &amp;lt;/executions&amp;gt;
    &amp;lt;/plugin&amp;gt;
  &amp;lt;/plugins&amp;gt;
&amp;lt;/build&amp;gt;

&amp;lt;dependencies&amp;gt;
  &amp;lt;dependency&amp;gt;
    &amp;lt;groupId&amp;gt;org.apache.maven.plugin-tools&amp;lt;/groupId&amp;gt;
    &amp;lt;artifactId&amp;gt;maven-plugin-annotations&amp;lt;/artifactId&amp;gt;
    &amp;lt;version&amp;gt;3.9.0&amp;lt;/version&amp;gt;
    &amp;lt;scope&amp;gt;provided&amp;lt;/scope&amp;gt;
  &amp;lt;/dependency&amp;gt;
&amp;lt;/dependencies&amp;gt;

</pre></div>


<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 class="wp-block-heading">Step 3: Create Your Plugin Logic</h3>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
@Mojo(name = &quot;greet&quot;, defaultPhase = LifecyclePhase.INSTALL)
public class GreetMojo extends AbstractMojo {

    @Parameter(property = &quot;greet.name&quot;, defaultValue = &quot;World&quot;)
    private String name;

    public void execute() throws MojoExecutionException {
        getLog().info(&quot;Greetings, &quot; + name + &quot;!&quot;);
    }
}

</pre></div>


<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 class="wp-block-heading">Step 4: Build the Plugin</h3>



<p class="wp-block-paragraph">Run:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
mvn clean install

</pre></div>


<p class="wp-block-paragraph">This will generate the <code>plugin.xml</code> and install the plugin in your local repo.</p>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 class="wp-block-heading">Step 5: Use the Plugin</h3>



<p class="wp-block-paragraph">In another project’s <code>pom.xml</code>:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
&amp;lt;build&amp;gt;
  &amp;lt;plugins&amp;gt;
    &amp;lt;plugin&amp;gt;
      &amp;lt;groupId&amp;gt;com.example.plugins&amp;lt;/groupId&amp;gt;
      &amp;lt;artifactId&amp;gt;custom-maven-plugin&amp;lt;/artifactId&amp;gt;
      &amp;lt;version&amp;gt;1.0-SNAPSHOT&amp;lt;/version&amp;gt;
      &amp;lt;executions&amp;gt;
        &amp;lt;execution&amp;gt;
          &amp;lt;goals&amp;gt;
            &amp;lt;goal&amp;gt;greet&amp;lt;/goal&amp;gt;
          &amp;lt;/goals&amp;gt;
        &amp;lt;/execution&amp;gt;
      &amp;lt;/executions&amp;gt;
    &amp;lt;/plugin&amp;gt;
  &amp;lt;/plugins&amp;gt;
&amp;lt;/build&amp;gt;

</pre></div>


<p class="wp-block-paragraph">Run the plugin:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
mvn com.example.plugins:custom-maven-plugin:1.0-SNAPSHOT:greet -Dgreet.name=&quot;Sneha&quot;

</pre></div>


<p class="wp-block-paragraph"></p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/understanding-maven-plugin-annotations-a-developers-guide/">Understanding Maven Plugin Annotations: A Developer’s Guide</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/understanding-maven-plugin-annotations-a-developers-guide/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Sonar mojo 1.0-beta-2 Released by Mojo team &#8211; Configure now</title>
		<link>https://www.scmgalaxy.com/tutorials/sonar-mojo-10-beta-2/</link>
					<comments>https://www.scmgalaxy.com/tutorials/sonar-mojo-10-beta-2/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Tue, 14 Sep 2010 11:16:41 +0000</pubDate>
				<category><![CDATA[Release, News & Updates]]></category>
		<category><![CDATA[Configuration Plugin for Sonar Mojo]]></category>
		<category><![CDATA[Feature]]></category>
		<category><![CDATA[Launch]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[Maven Sonar Mojo Plugin]]></category>
		<category><![CDATA[Mojo]]></category>
		<category><![CDATA[Mojo sonar maven plugin configure]]></category>
		<category><![CDATA[Mojo sonar maven plugin properties]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[Release]]></category>
		<category><![CDATA[Sonar]]></category>
		<category><![CDATA[Sonar Maven Configuration]]></category>
		<category><![CDATA[Sonar Maven Plugin 1.0-beta-2]]></category>
		<category><![CDATA[Sonar Maven Plugin version 1.0-beta-2]]></category>
		<category><![CDATA[Sonar Mojo Maven Plugin]]></category>
		<category><![CDATA[Upgrade]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/2010/09/14/sonar-mojo-10-beta-2/</guid>

					<description><![CDATA[<p>The Mojo team is pleased to announce the release of Sonar Maven Plugin, version 1.0-beta-2. It makes configuration easier when [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/sonar-mojo-10-beta-2/">Sonar mojo 1.0-beta-2 Released by Mojo team &#8211; Configure now</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div style="text-align: justify;">
<p><img decoding="async" class="alignnone size-full wp-image-4362" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2010/09/sonar-mojo-10.png" alt="sonar-mojo-10" width="600" height="400" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2010/09/sonar-mojo-10.png 600w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2010/09/sonar-mojo-10-300x200.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></p>
<p>The Mojo team is pleased to announce the release of Sonar Maven Plugin, version 1.0-beta-2. It makes configuration easier when using a repository manager like Archivaor Nexus. Indeed no additional settings are required anymore ! Let&#8217;s remind that the version 1.0-beta-1 needs to declare a mirror in maven settings.</p>
<p>This improvement requires Sonar 2.2+. It is automatically disabled when using sonar 2.1 or less. Upgrading to this version should be automatic if the shortcut &#8220;mvn sonar:sonar&#8221; is used.</p>
</div>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/sonar-mojo-10-beta-2/">Sonar mojo 1.0-beta-2 Released by Mojo team &#8211; Configure now</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/sonar-mojo-10-beta-2/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
