Maven 2 plugin, build + surefire

If I define a plugin in the <build> tag and want to use it in my site team, how to do it? Should I define the plugin inside the <report> tag again?

What about the configuration that I probably made in the build tag and want to have a place in the reporting tag too? (I donโ€™t want, for example, to indicate the location of the configuration file in order to use the plugin in 2 life cycles)

As an example: I define my checkstyle plugin in the assembly tag and set a custom location for the rules to be used. I do this because the rules are packaged in a jar, so I can define it as a dependency. This would not be possible if I do this in the reporting tag. But I need to use this plugin in the reporting tag, so that surfing can create a report for verification. Therefore, I must also define the plugin inside the reporting tag.

Maybe I'm doing something completely wrong here, but I donโ€™t see how I can do it otherwise. I do not like that I have one plugin twice in my pom (in the build tag and reporting tag).

I hope someone can check my solution in order or give me advice on how to do it better.

THX

Cook

+3
2

maven , . , , , .

, , . . , , ( ) :

<plugin>
   <artifactId>maven-surefire-plugin</artifactId>
       <configuration>
            <skip>true</skip>
       </configuration>
   ... More plugin cofniguration stuff ...
 </plugin>

moudules , :

<plugin>
   <artifactId>maven-surefire-plugin</artifactId>
       <configuration>
            <skip>false</skip>
       </configuration>
   ... Maybe Configuration ....
 </plugin>

. , , .

, , ?

+4

KRosenvold , <pluginManagment>, , pom , , , .

Pom:

<pluginManagement>
    <plugins>
        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.2-beta-1</version>
        </plugin>
    </plugins>
<pluginManagement>

Child Pom:

<plugins>
    <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
    </plugin>
</plugins>
+2

Source: https://habr.com/ru/post/1703083/


All Articles