I'm developing a maven plugin with a goal that has a parameter of a class.
I want to configure this goal to use a special class.
This is my Mojo of the maven plugin:
/**
* The used parser.
*
* @parameter expression="${parser}"
*/
private EndpointParser parser;
public void execute() throws MojoExecutionException {
This is my pom.xml of the project using the plugin:
...
<plugins>
<plugin>
<groupId>foo</groupId>
<artifactId>bar</artifactId>
<configuration>
<parser>com.foo.bar.MyEndpointParser</parser>
</configuration>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<phase>generate-sources</phase>
</execution>
</executions>
</plugin>
</plugins>
...
How do I get it working.
If MyEndPointParser
is not part of your plugin but another project (which is not isself a dependency of your plugin) you have to declare it as dependency not of your project but of your plugin e.g.
<plugins>
<plugin>
<groupId>foo</groupId>
<artifactId>bar</artifactId>
<configuration>
<parser>com.foo.bar.MyEndpointParser</parser>
</configuration>
<dependencies>
<dependency>
<groupId>foo</groupId>
<artifactId>contains-my-endpoint-parser</artifactId>
</dependency>
</dependencies>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<phase>generate-sources</phase>
</execution>
</executions>
</plugin>
</plugins>
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加