I am trying to generate a maven plugin as described in the maven documentation.
So I created a new plugin project with Eclipse, using the mvn archetype:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.test</groupId>
<artifactId>hotdeploy</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>maven-plugin</packaging>
<description>Maven Plugin to hotdeploy portlets to server</description>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>2.2.1</version>
</dependency>
</dependencies>
</project>
I used the created java class file:
package com.test.mavenplugins;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
/**
* Hot Deploy something components to local server.
* @goal hotdeploy
*/
public class HotDeployMojo extends AbstractMojo {
public void execute() throws MojoExecutionException
{
getLog().info("Hello, world.");
}
}
and ran mvn install
without errors. Then I included this plugin in another project:
<build>
<plugins>
<plugin>
<groupId>com.test</groupId>
<artifactId>hotdeploy</artifactId>
<version>0.0.1-SNAPSHOT</version>
</plugin>
</plugins>
</build>
But when I call mvn com.test:hotdeploy:hotdeploy
, I get the following error:
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Required goal not found: com.test:hotdeploy:hotdeploy in com.test:hotdeploy:0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Can anybody help me resolve this error?