You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Alexander Kriegisch (Jira)" <ji...@apache.org> on 2020/10/19 02:24:00 UTC
[jira] [Commented] (MNG-6222) Support exclusion of direct plugin
dependencies
[ https://issues.apache.org/jira/browse/MNG-6222?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17216413#comment-17216413 ]
Alexander Kriegisch commented on MNG-6222:
------------------------------------------
FWIW, while [answering StackOverflow question #64408756](https://stackoverflow.com/a/64408756/1082681) I found a hacky workaround until this feature is implemented. _Disclaimer: This is a nightmare and I am not proud of it, but it works. Use with care!_
Add a module to your project, producing the artifact you wish to exclude with a dummy version number, e.g.
{code: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>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>dummy</version>
</project>
{code}
Then use the dummy artifact like this:
{code:xml}
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire.version}</version>
<configuration>
<threadCount>1</threadCount>
<properties>
<!-- Avoid running JUnit 4 tests in TestNG engine -->
<property>
<name>junit</name>
<value>false</value>
</property>
</properties>
</configuration>
<dependencies>
<dependency>
<!-- Deactivate JUnit 4.7 engine by overriding it with an empty dummy -->
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>dummy</version>
</dependency>
</dependencies>
</plugin>
<!-- (...) -->
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>dummy</version>
</dependency>
</dependencies>
{code}
> Support exclusion of direct plugin dependencies
> -----------------------------------------------
>
> Key: MNG-6222
> URL: https://issues.apache.org/jira/browse/MNG-6222
> Project: Maven
> Issue Type: Improvement
> Components: Plugins and Lifecycle
> Reporter: Robert Scholte
> Priority: Major
> Fix For: Issues to be reviewed for 4.x
>
>
> Based on http://stackoverflow.com/questions/43630262/how-to-exclude-a-direct-dependency-of-a-maven-plugin
> {code:xml}
> <build>
> <plugins>
> <plugin>
> <groupId>org.jvnet.jaxb2.maven2</groupId>
> <artifactId>maven-jaxb2-plugin</artifactId>
> <version>0.13.2</version>
> <dependencies>
> <dependency>
> <!-- how to exclude javax.xml.bind:jaxb-api so it can be picked up by the JRE -->
> </dependency>
> </dependencies>
> </plugin>
> </plugins>
> </build>
> {code}
> Up until now there hasn't been any reason to do this, but this seems like a valid one. Most clean solution I can think of is allowing to override the scope with "none" for plugin dependencies.
> This solution won't break the pom-4.0.0.xsd
--
This message was sent by Atlassian Jira
(v8.3.4#803005)