Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/database/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 罐子太大了。如何在maven项目中减少jar大小?_Java_Maven_Build_Size_Deeplearning4j - Fatal编程技术网

Java 罐子太大了。如何在maven项目中减少jar大小?

Java 罐子太大了。如何在maven项目中减少jar大小?,java,maven,build,size,deeplearning4j,Java,Maven,Build,Size,Deeplearning4j,当我构建maven项目时,我得到了一个300mb的大罐子。它必须在下面 75mb。有没有办法不编译未使用的maven库/依赖项? 或者有没有办法找出我的项目不需要哪些库/依赖项?是您正在寻找的插件。它将查找已使用+未声明(=可传递)依赖项和未使用+声明的依赖项。 请注意,它无法检测反射。是您正在寻找的插件。它将查找已使用+未声明(=可传递)依赖项和未使用+声明的依赖项。 请注意,它无法检测反射。听起来您需要包括“瘦战争”选项。您能否在您的项目中尝试以下POM,并让我们知道这是否有助于从300MB

当我构建maven项目时,我得到了一个300mb的大罐子。它必须在下面 75mb。有没有办法不编译未使用的maven库/依赖项? 或者有没有办法找出我的项目不需要哪些库/依赖项?

是您正在寻找的插件。它将查找已使用+未声明(=可传递)依赖项和未使用+声明的依赖项。 请注意,它无法检测反射。

是您正在寻找的插件。它将查找已使用+未声明(=可传递)依赖项和未使用+声明的依赖项。
请注意,它无法检测反射。

听起来您需要包括“瘦战争”选项。您能否在您的项目中尝试以下POM,并让我们知道这是否有助于从300MB减少到300MB

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>${war-plugin-version}</version>
    <configuration>
        <failOnMissingWebXml>false</failOnMissingWebXml>
        <packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes>
        <archive>
            <manifest>
                <addClasspath>true</addClasspath>
                <classpathPrefix>lib/</classpathPrefix>
            </manifest>
        </archive>
        <webResources>
            <resource>
                <filtering>true</filtering>
                <directory>src/main/webapp</directory>
                <includes>
                    <include>**/web.xml</include>
                </includes>
            </resource>
        </webResources>
    </configuration>
</plugin>

org.apache.maven.plugins
maven战争插件
${war插件版本}
假的
WEB-INF/lib/*.jar
真的
解放党/
真的
src/main/webapp
**/web.xml

听起来您需要包括“瘦战争”选项。您能否在您的项目中尝试以下POM,并让我们知道这是否有助于从300MB减少到300MB

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>${war-plugin-version}</version>
    <configuration>
        <failOnMissingWebXml>false</failOnMissingWebXml>
        <packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes>
        <archive>
            <manifest>
                <addClasspath>true</addClasspath>
                <classpathPrefix>lib/</classpathPrefix>
            </manifest>
        </archive>
        <webResources>
            <resource>
                <filtering>true</filtering>
                <directory>src/main/webapp</directory>
                <includes>
                    <include>**/web.xml</include>
                </includes>
            </resource>
        </webResources>
    </configuration>
</plugin>

org.apache.maven.plugins
maven战争插件
${war插件版本}
假的
WEB-INF/lib/*.jar
真的
解放党/
真的
src/main/webapp
**/web.xml

提供pom.xml的代码片段一个大约为300MB的jar文件?那个模块里有多少类?您正在创建一个可执行的jar吗?请提供pom.xml的代码片段作为一个jar文件,大约为300MB?那个模块里有多少类?您正在创建一个可执行的jar吗?