我创建了一个maven插件,MVN干净安装构建成功,但plugin.xml没有生成。未生成maven插件描述符
@Mojo(name = "cover", defaultPhase = LifecyclePhase.POST_INTEGRATION_TEST)
public class RunCoverage extends AbstractMojo
{
@Parameter(property = "cover.wadl", defaultValue = "test")
private String wadl;
@Parameter(property = "cover.endpoints",defaultValue = "test")
private String endpoints;
@Override
public void execute() throws MojoExecutionException
{
<somecode>
}
}
而且pom.xml的是
<?xml version="1.0" encoding="UTF-8"?>
<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>
<artifactId>end-point-test-coverage</artifactId>
<version>1</version>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.2</version>
<executions>
<execution>
<id>default-descriptor</id>
<goals>
<goal>descriptor</goal>
</goals>
<phase>process-classes</phase>
</execution>
<execution>
<id>help-descriptor</id>
<goals>
<goal>helpmojo</goal>
</goals>
<phase>process-classes</phase>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Maven的干净的安装不会生成的plugin.xml
当在相关项目中使用,我发现了以下错误
无法解析它的插件描述符..gruppopam.common:end-point-test-coverage:1(/home/d/.m2/repository/it/common/end-point-test-coverage/1/end- point-test-coverage-1.jar):没有插件descr iptor发现在META-INF /行家/ plugin.xml中 - > [帮助1] [ERROR]
首先我想尝试的包装类型设置为'Maven的插件'而不是'jar'的默认值。此外,我会建议使用更多最新版本的插件(maven-compiler-plugin:3.1)并使用更新版本的maven-plugin-api(3.0?但不是2.0)。除此之外,你可以在'mvn clean package'期间发布完整的输出,或者这个项目可以在Github上找到或类似的东西吗? – khmarbaise
@khmarbaise非常感谢,我改变了包装类型,并将插件更新到最新版本。事情就像微风一样工作。 – deepak