Maven plugin configuration set parameter to class

matcauthon

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.

ooxi

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]

編集
0

コメントを追加

0

関連記事

分類Dev

Maven Plugin Mojo Configure Default Parameter Values

分類Dev

Maven Plugin Mojo Configure Default Parameter Values

分類Dev

Maven release plugin - tagbase configuration - tags folder included in project

分類Dev

SonarQube Plugin Post Analysis Task only when Scanner Parameter set

分類Dev

Hooking custom maven plugin with maven release plugin

分類Dev

spring-boot-maven-plugin spring-boot.run.main-class is ignored (Groovy)

分類Dev

Creating a Maven report plugin

分類Dev

Maven resources plugin dependency

分類Dev

Set a class private string parameter with some value at build time in .net core 3.1 class library project

分類Dev

Using exec-maven-plugin to a maven phase

分類Dev

Configuration for grails-redis plugin

分類Dev

Vundle (plugin for Vim) configuration problem

分類Dev

maven-remote-resources-pluginとmaven-resources-plugin

分類Dev

spring-boot-maven-plugin spring-boot.run.main-classは無視されます(Groovy)

分類Dev

Using maven ant plugin in javafx application, How to add Dependencies in javaFX jar. Still facing class not found exception

分類Dev

Maven Plugin for project semantic versioning

分類Dev

Bamboo maven plugin cannot be found

分類Dev

Set parameter of any Func<>

分類Dev

conditional set parameter in hibernate

分類Dev

python class default parameter

分類Dev

Springfox class Parameter is deprecated

分類Dev

Template as parameter in class

分類Dev

Eslint-plugin-react configuration docs

分類Dev

modernizer-maven-plugin Joda Instant

分類Dev

UnsupportedClassVersionError:org / apache / maven / plugin / compiler / TestCompilerMojo

分類Dev

maven-jaxb2-pluginのAutoNameResolution

分類Dev

親pomのmaven-compiler-plugin

分類Dev

proguard-maven-plugin java 8

分類Dev

Using XJB with jaxb2-maven-plugin

Related 関連記事

  1. 1

    Maven Plugin Mojo Configure Default Parameter Values

  2. 2

    Maven Plugin Mojo Configure Default Parameter Values

  3. 3

    Maven release plugin - tagbase configuration - tags folder included in project

  4. 4

    SonarQube Plugin Post Analysis Task only when Scanner Parameter set

  5. 5

    Hooking custom maven plugin with maven release plugin

  6. 6

    spring-boot-maven-plugin spring-boot.run.main-class is ignored (Groovy)

  7. 7

    Creating a Maven report plugin

  8. 8

    Maven resources plugin dependency

  9. 9

    Set a class private string parameter with some value at build time in .net core 3.1 class library project

  10. 10

    Using exec-maven-plugin to a maven phase

  11. 11

    Configuration for grails-redis plugin

  12. 12

    Vundle (plugin for Vim) configuration problem

  13. 13

    maven-remote-resources-pluginとmaven-resources-plugin

  14. 14

    spring-boot-maven-plugin spring-boot.run.main-classは無視されます(Groovy)

  15. 15

    Using maven ant plugin in javafx application, How to add Dependencies in javaFX jar. Still facing class not found exception

  16. 16

    Maven Plugin for project semantic versioning

  17. 17

    Bamboo maven plugin cannot be found

  18. 18

    Set parameter of any Func<>

  19. 19

    conditional set parameter in hibernate

  20. 20

    python class default parameter

  21. 21

    Springfox class Parameter is deprecated

  22. 22

    Template as parameter in class

  23. 23

    Eslint-plugin-react configuration docs

  24. 24

    modernizer-maven-plugin Joda Instant

  25. 25

    UnsupportedClassVersionError:org / apache / maven / plugin / compiler / TestCompilerMojo

  26. 26

    maven-jaxb2-pluginのAutoNameResolution

  27. 27

    親pomのmaven-compiler-plugin

  28. 28

    proguard-maven-plugin java 8

  29. 29

    Using XJB with jaxb2-maven-plugin

ホットタグ

アーカイブ