You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Gaurav Gupta <ga...@apache.org> on 2016/09/20 00:51:35 UTC

Excluding transitive dependencies of plugins

Hi,

I have a use case where I need to exclude transitive dependency of a plugin.
I am using following plugin

<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.7</version>

This has transitive dependency on logback-classic. To exclude this
dependency, I tried following two options

1.
<build>

  <plugins>
    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>cobertura-maven-plugin</artifactId>
      <version>2.7</version>
      <dependencies>
        <dependency>
          <groupId>net.sourceforge.cobertura</groupId>
          <artifactId>cobertura</artifactId>
          <version>2.1.1</version>
          <exclusions>
            <exclusion>
              <groupId>ch.qos.logback</groupId>
              <artifactId>logback-classic</artifactId>
            </exclusion>
          </exclusions>
        </dependency>
      </dependencies>
      <configuration>
        <check></check>
      </configuration>
      <executions>
        <execution>
          <phase>process-classes</phase>
          <goals>
            <goal>instrument</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>

2. <build>

  <plugins>
    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>cobertura-maven-plugin</artifactId>
      <version>2.7</version>
      <configuration>
        <check></check>
      </configuration>
      <executions>
        <execution>
          <phase>process-classes</phase>
          <goals>
            <goal>instrument</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>

<dependencies>
  <dependency>
    <groupId>net.sourceforge.cobertura</groupId>
    <artifactId>cobertura</artifactId>
    <version>2.1.1</version>
    <exclusions>
      <exclusion>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
      </exclusion>
    </exclusions>
  </dependency>
</dependencies>


But with both options I see that logback-classic is downloaded.
Can someone please point me to correct usage of this?

Thanks
Gaurav

Re: Excluding transitive dependencies of plugins

Posted by Gaurav Gupta <ga...@apache.org>.
Any pointers please?

Thanks
Gaurav

On Mon, Sep 19, 2016 at 5:51 PM, Gaurav Gupta <ga...@apache.org>
wrote:

> Hi,
>
> I have a use case where I need to exclude transitive dependency of a
> plugin.
> I am using following plugin
>
> <groupId>org.codehaus.mojo</groupId>
> <artifactId>cobertura-maven-plugin</artifactId>
> <version>2.7</version>
>
> This has transitive dependency on logback-classic. To exclude this
> dependency, I tried following two options
>
> 1.
> <build>
>
>   <plugins>
>     <plugin>
>       <groupId>org.codehaus.mojo</groupId>
>       <artifactId>cobertura-maven-plugin</artifactId>
>       <version>2.7</version>
>       <dependencies>
>         <dependency>
>           <groupId>net.sourceforge.cobertura</groupId>
>           <artifactId>cobertura</artifactId>
>           <version>2.1.1</version>
>           <exclusions>
>             <exclusion>
>               <groupId>ch.qos.logback</groupId>
>               <artifactId>logback-classic</artifactId>
>             </exclusion>
>           </exclusions>
>         </dependency>
>       </dependencies>
>       <configuration>
>         <check></check>
>       </configuration>
>       <executions>
>         <execution>
>           <phase>process-classes</phase>
>           <goals>
>             <goal>instrument</goal>
>           </goals>
>         </execution>
>       </executions>
>     </plugin>
>   </plugins>
> </build>
>
> 2. <build>
>
>   <plugins>
>     <plugin>
>       <groupId>org.codehaus.mojo</groupId>
>       <artifactId>cobertura-maven-plugin</artifactId>
>       <version>2.7</version>
>       <configuration>
>         <check></check>
>       </configuration>
>       <executions>
>         <execution>
>           <phase>process-classes</phase>
>           <goals>
>             <goal>instrument</goal>
>           </goals>
>         </execution>
>       </executions>
>     </plugin>
>   </plugins>
> </build>
>
> <dependencies>
>   <dependency>
>     <groupId>net.sourceforge.cobertura</groupId>
>     <artifactId>cobertura</artifactId>
>     <version>2.1.1</version>
>     <exclusions>
>       <exclusion>
>         <groupId>ch.qos.logback</groupId>
>         <artifactId>logback-classic</artifactId>
>       </exclusion>
>     </exclusions>
>   </dependency>
> </dependencies>
>
>
> But with both options I see that logback-classic is downloaded.
> Can someone please point me to correct usage of this?
>
> Thanks
> Gaurav
>
>
>