Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.0.2
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      1

      Description

      Added a warLibIncludes element to include only the specified list of jars because the warSourceExcludes is never finished when you add new dependencies to a project.

        Activity

        Hide
        Jene Jasper added a comment -

        Now just create the project parent pom with all shared dependencies, for example:

        <?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/maven-v4_0_0.xsd">

        <modelVersion>4.0.0</modelVersion>
        <groupId>nl.abz</groupId>
        <artifactId>test</artifactId>
        <packaging>pom</packaging>
        <version>v0100</version>
        <name>Test project</name>

        <dependencies>
        <dependency>
        <groupId>org.apache.myfaces.core</groupId>
        <artifactId>myfaces-api</artifactId>
        <version>1.1.5</version>
        <scope>compile</scope>
        <type>jar</type>
        </dependency>

        <dependency>
        <groupId>struts</groupId>
        <artifactId>struts</artifactId>
        <version>1.2.7</version>
        <scope>compile</scope>
        </dependency>
        </dependencies>
        </project>

        Show
        Jene Jasper added a comment - Now just create the project parent pom with all shared dependencies, for example: <?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/maven-v4_0_0.xsd "> <modelVersion>4.0.0</modelVersion> <groupId>nl.abz</groupId> <artifactId>test</artifactId> <packaging>pom</packaging> <version>v0100</version> <name>Test project</name> <dependencies> <dependency> <groupId>org.apache.myfaces.core</groupId> <artifactId>myfaces-api</artifactId> <version>1.1.5</version> <scope>compile</scope> <type>jar</type> </dependency> <dependency> <groupId>struts</groupId> <artifactId>struts</artifactId> <version>1.2.7</version> <scope>compile</scope> </dependency> </dependencies> </project>
        Hide
        Jene Jasper added a comment -

        Next create the project webapp pom with optional specific dependencies, for example:

        <?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/maven-v4_0_0.xsd">

        <parent>
        <groupId>nl.abz</groupId>
        <artifactId>test</artifactId>
        <version>v0100</version>
        </parent>

        <modelVersion>4.0.0</modelVersion>
        <groupId>nl.abz.test</groupId>
        <artifactId>test-webapp</artifactId>
        <packaging>war</packaging>
        <name>Test project WebApp</name>

        <dependencies>
        <dependency>
        <groupId>org.apache.myfaces.core</groupId>
        <artifactId>myfaces-impl</artifactId>
        <version>1.1.5</version>
        <scope>compile</scope>
        <type>jar</type>
        </dependency>
        </dependencies>

        <build>
        <plugins>
        <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.0.2.patch.MWAR-146</version>
        <configuration>
        <warSourceExcludes>
        WEB-INF/lib/*.jar,
        </warSourceExcludes>
        <warLibIncludes>
        WEB-INF/lib/struts-*.jar,
        WEB-INF/lib/myfaces-impl-*.jar,
        </warLibIncludes>
        </configuration>
        </plugin>
        </plugins>
        </build>
        </project>

        Show
        Jene Jasper added a comment - Next create the project webapp pom with optional specific dependencies, for example: <?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/maven-v4_0_0.xsd "> <parent> <groupId>nl.abz</groupId> <artifactId>test</artifactId> <version>v0100</version> </parent> <modelVersion>4.0.0</modelVersion> <groupId>nl.abz.test</groupId> <artifactId>test-webapp</artifactId> <packaging>war</packaging> <name>Test project WebApp</name> <dependencies> <dependency> <groupId>org.apache.myfaces.core</groupId> <artifactId>myfaces-impl</artifactId> <version>1.1.5</version> <scope>compile</scope> <type>jar</type> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.0.2.patch. MWAR-146 </version> <configuration> <warSourceExcludes> WEB-INF/lib/*.jar, </warSourceExcludes> <warLibIncludes> WEB-INF/lib/struts-*.jar, WEB-INF/lib/myfaces-impl-*.jar, </warLibIncludes> </configuration> </plugin> </plugins> </build> </project>
        Hide
        Jene Jasper added a comment -

        Finally create the project app pom and optionally exclude webapp packaged shared dependencies, for example:

        <?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/maven-v4_0_0.xsd">

        <parent>
        <groupId>nl.abz</groupId>
        <artifactId>test</artifactId>
        <version>v0100</version>
        </parent>

        <modelVersion>4.0.0</modelVersion>
        <groupId>nl.abz.test</groupId>
        <artifactId>test-app</artifactId>
        <packaging>ear</packaging>
        <name>Test project App</name>

        <dependencies>
        <dependency>
        <groupId>nl.abz.test</groupId>
        <artifactId>test-webapp</artifactId>
        <type>war</type>
        <version>$

        {project.version}

        </version>
        </dependency>
        </dependency>
        </dependencies>

        <build>
        <plugins>
        <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-ear-plugin</artifactId>
        <configuration>
        <defaultJavaBundleDir>APP-INF/lib/</defaultJavaBundleDir>
        <modules>
        <jarModule>
        <groupId>struts</groupId>
        <artifactId>struts</artifactId>
        <excluded>true</excluded>
        </jarModule>
        <webModule>
        <groupId>nl.abz.test</groupId>
        <artifactId>test-webapp</artifactId>
        <contextRoot>/test-portal</contextRoot>
        </webModule>
        </modules>
        </configuration>
        </plugin>
        </plugins>
        </build>
        </project>

        Note: the defaultJavaBundleDir is set to APP-INF/lib/ so that we do not need to specify does files in the web-app MANIFEST.MF

        Show
        Jene Jasper added a comment - Finally create the project app pom and optionally exclude webapp packaged shared dependencies, for example: <?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/maven-v4_0_0.xsd "> <parent> <groupId>nl.abz</groupId> <artifactId>test</artifactId> <version>v0100</version> </parent> <modelVersion>4.0.0</modelVersion> <groupId>nl.abz.test</groupId> <artifactId>test-app</artifactId> <packaging>ear</packaging> <name>Test project App</name> <dependencies> <dependency> <groupId>nl.abz.test</groupId> <artifactId>test-webapp</artifactId> <type>war</type> <version>$ {project.version} </version> </dependency> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-ear-plugin</artifactId> <configuration> <defaultJavaBundleDir>APP-INF/lib/</defaultJavaBundleDir> <modules> <jarModule> <groupId>struts</groupId> <artifactId>struts</artifactId> <excluded>true</excluded> </jarModule> <webModule> <groupId>nl.abz.test</groupId> <artifactId>test-webapp</artifactId> <contextRoot>/test-portal</contextRoot> </webModule> </modules> </configuration> </plugin> </plugins> </build> </project> Note: the defaultJavaBundleDir is set to APP-INF/lib/ so that we do not need to specify does files in the web-app MANIFEST.MF
        Hide
        Jene Jasper added a comment -

        Patch to add warLibIncludes element. The warLibExcludes element is unused for now but just added for completeness.

        Show
        Jene Jasper added a comment - Patch to add warLibIncludes element. The warLibExcludes element is unused for now but just added for completeness.
        Hide
        Stéphane Nicoll added a comment -

        There's a packagingExcludes in 2.1-alpha-2 (current trunk) It does what you want

        Show
        Stéphane Nicoll added a comment - There's a packagingExcludes in 2.1-alpha-2 (current trunk) It does what you want
        Hide
        Jene Jasper added a comment -

        Is there also something like packagingIncludes because I do not want to edit the war pom.xml every time a shared library is added?

        Show
        Jene Jasper added a comment - Is there also something like packagingIncludes because I do not want to edit the war pom.xml every time a shared library is added?
        Hide
        Stéphane Nicoll added a comment -

        No. The include is based on the resources and the includes/excludes settings.

        Show
        Stéphane Nicoll added a comment - No. The include is based on the resources and the includes/excludes settings.

          People

          • Assignee:
            Stéphane Nicoll
            Reporter:
            Jene Jasper
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: