This section will show how to use a Plexus component from within a Maven mojo.
Maven Archetypes are discussed in detail here.
mvn archetype:create -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-mojo \
-DarchetypeVersion=1.0-SNAPSHOT -DgroupId=org.codehaus.plexus -DartifactId=plexus-website-monitor-plugin
The maven-archetype-mojo sets up a skeleton Maven plugin project 'plexus-website-monitor-plugin' for us with reasonable defaults.
The pom.xml should look like this now:
<?xml version="1.0"?>
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-website-monitor-plugin</artifactId>
<packaging>maven-plugin</packaging>
<name>Maven Mojo Archetype</name>
<version>1.0-SNAPSHOT</version>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-website-monitor-component</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
Note that this step assumes that we have Plexus Website Monitor Component available in our local repository or downloadable from a remote repository.
mvn eclipse:eclipse
The website monitor plugin should now be set up as a project under Eclipse.