You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Matt Raible <mr...@gmail.com> on 2006/08/27 23:18:53 UTC

Is it possible to publish a WAR w/o WEB-INF/lib?

I've made quite a bit of headway this week converting AppFuse to use
Maven 2[1].  Thanks to everyone on this list for their help.

You can now create a new project with a simple pom.xml:

<project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.mycompany</groupId>
    <artifactId>test-appfuse</artifactId>
    <packaging>war</packaging>
    <version>1.0</version>

    <repositories>
        <repository>
            <id>appfuse</id>
            <url>http://static.appfuse.org/repository</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.appfuse</groupId>
            <artifactId>appfuse-struts-war</artifactId>
            <version>2.0-SNAPSHOT</version>
            <type>war</type>
        </dependency>
    </dependencies>
</project>

The problem with this setup is you won't get the WARs dependencies in
your classpath.  I've found that including the JAR and the WAR as
dependencies solves this issue.

    <dependencies>
        <dependency>
            <groupId>org.appfuse</groupId>
            <artifactId>appfuse-struts</artifactId>
            <version>2.0-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>org.appfuse</groupId>
            <artifactId>appfuse-struts-war</artifactId>
            <version>2.0-SNAPSHOT</version>
            <type>war</type>
        </dependency>
    </dependencies>

To control the dependencies that end up in your final WEB-INF/lib,
I've found it necessary to do the following:

            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <dependentWarExcludes>WEB-INF/lib</dependentWarExcludes>
                </configuration>
            </plugin>

Is it possible to adjust appfuse-struts-war's pom.xml so it builds
it's own WAR correctly (when using mvn package), but "installs" the
WAR w/o any JARs?  That seems like the best way to set things up so
dependencies can still be a part of the end user's project, and they
can get the WAR overlaid w/o getting JARs from it.

Thanks,

Matt

[1] http://raibledesigns.com/page/rd?entry=appfuse_2_0_status1

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org