首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Maven :将Jar打包到本地文件系统中,而不是WAR文件中。

Maven :将Jar打包到本地文件系统中,而不是WAR文件中。
EN

Stack Overflow用户
提问于 2017-02-27 17:57:08
回答 2查看 266关注 0票数 1

我们正在开发一个Spring-MVC项目,其中我们使用Maven作为依赖项管理工具,部署在Apache Tomcat上。目前,我们还在集成Stanford解析器,添加模型库会将我们的WAR文件的大小从192Mb增加到600Mb。

这给我们带来了一个问题,因为我们还在开发中,我们更频繁地在测试系统上进行部署,并希望减少上传文件所需的延迟。

有没有办法,我们可以将这些JAR添加到我们的本地文件系统中,而不是包含在WAR文件中?谢谢。

POM.xml:

代码语言:javascript
复制
    <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>
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2017-02-27 18:01:41

你有没有尝试过作用域provided --它应该被排除在战争之外。

文档project object model

票数 1
EN

Stack Overflow用户

发布于 2017-02-27 18:02:54

您可以将这些大型库移动到Tomcat lib文件夹中,而不在打包的war中提供它们,方法是按照Maven中提供的方式指定它们。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42482655

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档