maven-webstart-plugin exclude specific transitive dependencies

624 Views Asked by At

I'm using maven-webstart-plugin to generate 2 JNLP (jnlpA and jnlpB), configured as 2 executions. The project, has 2 dependencies:

  • dependencyA.jar (that depends of some commons and others as A1.jar, A2.jar, A3.jar...)
  • dependencyB.jar (that depends of some commons and others as B1.jar, B2.jar, B3.jar...).

I need that jnlpA has as dependencies dependencyA.jar, commons and A1.jar, A2.jar, A3.jar... And jnlpB dependencyB.jar, commons and B1.jar, B2.jar, B3.jar... I don't know how to do this with maven-webstart-plugin.

I have tried with this:

  1. Use the plugin property called "excludeTransitive" to false (default). In this case both JNLP will have all dependencies.

  2. Change "excludeTransitive" to true, in this case both JNLP will only have dependencyA.jar and dependencyB.jar as dependencies.

  3. With "excludeTransitive" to false (default), use the options exclude and include that the plugin allow to use in each execution:

    • If I use exclude in the execution of jnlpA, and I exclude dependencyB.jar, the jnlpA still has as dependenci B1.jar, B2.jar... I.E. only exclude the dependency and not all its transitive dependencies.
    • If I use include in the execution of jnlpA, and I include dependencyA.jar, the A1.jar, A2.jar... are not included. I.E. only include this dependency and not all its transitive dependencies.

So, my problem is that I need to include or exclude a dependency in a execution but with all its transitive dependencies.

An example of my pom when I was trying option 3 was:

<?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>
<artifactId>MyJnlp</artifactId>
<packaging>pom</packaging>

<build>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>webstart-maven-plugin</artifactId>
            <version>1.0-beta-3</version>
            <executions>
                <execution>
                    <id>install-jnlp</id>
                    <phase>process-resources</phase>
                    <goals>
                        <goal>jnlp-inline</goal>
                    </goals>
                    <configuration>
                        <workDirectory>target/dist</workDirectory>
                        <jnlp>
                            <inputTemplate>src/main/jnlp/jnlpA-template.vm</inputTemplate>
                            <outputFile>jnlpA.jnlp</outputFile>
                            <mainClass>Start</mainClass>
                        </jnlp>
                        <dependencies>
                            <excludes>
                                <exclude>xxx:dependencyB</exclude>
                            </excludes>
                        </dependencies>
                    </configuration>
                </execution>
                <execution>
                    <id>uninstall-jnlp</id>
                    <phase>process-resources</phase>
                    <goals>
                        <goal>jnlp-inline</goal>
                    </goals>
                    <configuration>
                        <workDirectory>target/dist</workDirectory>
                        <jnlp>
                            <inputTemplate>src/main/jnlp/jnlpB-template.vm</inputTemplate>
                            <outputFile>jnlpB.jnlp</outputFile>
                            <mainClass>Uninstaller</mainClass>
                        </jnlp>
                        <dependencies>
                            <excludes>
                                <exclude>xxx:dependencyA</exclude>
                            </excludes>
                        </dependencies>
                    </configuration>
                </execution>
            </executions>
            <configuration>
                <excludeTransitive>false</excludeTransitive><resourcesDirectory>${project.basedir}/src/main/jnlp/resources</resourcesDirectory>
                <jnlp>
                    <inputTemplateResourcePath>${project.basedir}</inputTemplateResourcePath>
                </jnlp>
                <gzip>true</gzip>
                <makeArchive>false</makeArchive>
                <outputJarVersions>false</outputJarVersions>
                <verbose>true</verbose>
                <encoding>ISO-8859-1</encoding>
            </configuration>
        </plugin>
    </plugins>
</build>

<dependencies>
    <dependency>
        <groupId>xxx</groupId>
        <artifactId>dependencyA</artifactId>
        <version>1.0</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>xxx</groupId>
        <artifactId>dependencyB</artifactId>
        <version>1.0</version>
        <scope>runtime</scope>
    </dependency>
</dependencies>

0

There are 0 best solutions below