Maven: Packaging Jar on the local file system, but not in the WAR file.

advertisements

We are working on a Spring-MVC project in which we use Maven as a dependency management tool, deployed on Apache Tomcat. Currently, we are also integrating Stanford parser, and adding the model libraries is increasing our WAR file's size from 192Mb to 600Mb.

This presents us a problem as we are still in development, and we do deployments on our test system more often and would like to reduce the delay it takes in uploading files.

Is there any way, that we can add those JAR's on our local file-system from which they are referred but not included in the WAR file? Thank you.

POM.xml :

    <parent>
        <groupId>io.spring.platform</groupId>
        <artifactId>platform-bom</artifactId>
        <version>1.1.3.RELEASE</version>
        <relativePath />
    </parent>
    <dependencies>
 <dependency>
            <groupId>edu.stanford.nlp</groupId>
            <artifactId>stanford-parser</artifactId>
            <version>3.7.0</version>
        </dependency>

     <dependency>
            <groupId>edu.stanford.nlp</groupId>
            <artifactId>stanford-corenlp</artifactId>
            <version>3.7.0</version>
        </dependency>
        <dependency>
            <groupId>edu.stanford.nlp</groupId>
            <artifactId>stanford-corenlp</artifactId>
            <version>3.7.0</version>
            <classifier>models</classifier>
        </dependency>

        <dependency>
            <groupId>edu.stanford.nlp</groupId>
            <artifactId>stanford-corenlp</artifactId>
            <version>3.7.0</version>
            <classifier>models-german</classifier>
        </dependency>
// And other dependencies

<build>
        <plugins>
            <plugin>
                <groupId>com.samaxes.maven</groupId>
                <artifactId>minify-maven-plugin</artifactId>
                <version>1.7.4</version>
                 // Plugin configuration
           </plugin>
<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <compilerArgument>-Xlint:all</compilerArgument>
                    <showWarnings>false</showWarnings>
                    <showDeprecation>true</showDeprecation>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <configuration>
                    <mainClass>org.test.int1.Main</mainClass>
                </configuration>
            </plugin>


Did you try scope provided - it should be excluded from the war.

Documentation project object model