Maven custom plugin error
I just created a custom plugin using the archetype as described here:
https://maven.apache.org/guides/plugin/guide-java-plugin-development.html
I can compile the plugin, but I can't run the goal. What am I doing wrong?
/**
* Goal which touches a timestamp file.
*
* @deprecated Don't use!
*/
@Mojo(name = "touch", defaultPhase = LifecyclePhase.PROCESS_SOURCES)
public class MyMojo
extends AbstractMojo {
public void execute()
throws MojoExecutionException {
getLog().warn("Just a test");
}
}
Here is the usage example of the Mojo (in a different almost empty project):
<build>
<plugins>
<plugin>
<artifactId>hello-maven-plugin</artifactId>
<groupId>sample.plugin</groupId>
<version>1.0.0-SNAPSHOT</version>
</plugin>
</plugins>
</build>
On the commandline I run: mvn sample.plugin:hello-maven-plugin:touch
And I get this error:
Plugin sample.plugin:hello-maven-plugin:1.0.0-SNAPSHOT or one of its dependencies could not be resolved: Could not find artifact sample.plugin:hello-maven-plugin:jar:1.0.0-SNAPSHOT -> [Help 1]
Maven version is: Apache Maven 3.3.3
Any ideas what I am doing wrong?
Error says maven cannot locate your plugin artifact
After building your plugin , your plugin jar will be placed in your local repository. Check your local repo for this jar
samplepluginhello-maven-plugin1.0.0-SNAPSHOThello-maven-plugin-1.0.0-SNAPSHOT.jar
In the example version is 1.0-SNAPSHOT
.
上一篇: 为什么换档比给旧哈斯克尔供电慢呢? 如何让它更快?
下一篇: Maven自定义插件错误