配置 Maven 以使用自定义插件目标
configuring maven to use a custom plugin goal
我正在尝试安装和使用此存储库中的 maven 插件 - java2typescript
此插件有望从带注释的 java 类 生成打字稿定义文件。
我需要想办法 运行 这个插件。根据开发人员的建议,我已经配置了一个 jitpack 存储库,我可以在我的 maven 依赖项列表中看到插件依赖项,但我无法 运行 该插件。
我将以下配置添加到我的 pom -
在依赖项部分 -
<dependency>
<groupId>com.github.raphaeljolivet.java2typescript</groupId>
<artifactId>java2typescript-maven-plugin</artifactId>
<version>v0.3.0.rc1</version>
</dependency>
在构建部分 -
<plugin>
<groupId>java2typescript</groupId>
<artifactId>java2typescript-maven-plugin</artifactId>
<version>v0.3.0.rc1</version>
<executions>
<execution>
<id>generate</id>
<goals>
<goal>generate</goal>
</goals>
<phase>generate-sources</phase>
</execution>
</executions>
<configuration>
<serviceClass>com.example.rs.PeopleRestService</serviceClass>
<moduleName>People</moduleName>
<tsOutFolder>myTs</tsOutFolder>
<jsOutFolder>myJs</jsOutFolder>
</configuration>
</plugin>
如何执行插件目标?
你选错阶段了。对编译好的类进行操作,需要selectprocess-classes
作为相。然后运行mvn process-classes
测试一下。参见 the full lifecycle。
此外,插件位于 <pluginRepositories>
,而不是 <repositories>
,因此如果您必须为此插件添加自定义存储库,则必须将其添加到那里。由于您的插件不在 Maven Central 中,我很确定这是您的问题。
<pluginRepositories>
<pluginRepository>
<id>jfrog</id>
<name>My JFrog</name>
<url>http://wherever/i/have/put/jfrog</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
</pluginRepository>
</pluginRepositories>
我正在尝试安装和使用此存储库中的 maven 插件 - java2typescript
此插件有望从带注释的 java 类 生成打字稿定义文件。
我需要想办法 运行 这个插件。根据开发人员的建议,我已经配置了一个 jitpack 存储库,我可以在我的 maven 依赖项列表中看到插件依赖项,但我无法 运行 该插件。
我将以下配置添加到我的 pom -
在依赖项部分 -
<dependency>
<groupId>com.github.raphaeljolivet.java2typescript</groupId>
<artifactId>java2typescript-maven-plugin</artifactId>
<version>v0.3.0.rc1</version>
</dependency>
在构建部分 -
<plugin>
<groupId>java2typescript</groupId>
<artifactId>java2typescript-maven-plugin</artifactId>
<version>v0.3.0.rc1</version>
<executions>
<execution>
<id>generate</id>
<goals>
<goal>generate</goal>
</goals>
<phase>generate-sources</phase>
</execution>
</executions>
<configuration>
<serviceClass>com.example.rs.PeopleRestService</serviceClass>
<moduleName>People</moduleName>
<tsOutFolder>myTs</tsOutFolder>
<jsOutFolder>myJs</jsOutFolder>
</configuration>
</plugin>
如何执行插件目标?
你选错阶段了。对编译好的类进行操作,需要selectprocess-classes
作为相。然后运行mvn process-classes
测试一下。参见 the full lifecycle。
此外,插件位于 <pluginRepositories>
,而不是 <repositories>
,因此如果您必须为此插件添加自定义存储库,则必须将其添加到那里。由于您的插件不在 Maven Central 中,我很确定这是您的问题。
<pluginRepositories>
<pluginRepository>
<id>jfrog</id>
<name>My JFrog</name>
<url>http://wherever/i/have/put/jfrog</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
</pluginRepository>
</pluginRepositories>