如何将单个JAR文件与DIST文件夹中的所有其他JAR库一起制作



我创建了一个应用程序。在此应用程序中,我疑问,当获得输出时,我需要包括lib(包含所有支持JAR文件的库文件夹),但是我需要在一个JAR文件中,必须包括所有支持JARS。是否可以?我正在使用NetBeans。

您不告诉我们您用什么来构建代码。我要猜到Maven(因为我知道答案是在Maven中!)。您需要的是:

<build>
    <plugins>
        <plugin>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>copy-dependencies</goal>
                    </goals>
                    <configuration>
                        <includeScope>runtime</includeScope>
                        <outputDirectory>${project.build.directory}/lib</outputDirectory>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <!-- Add your other plug-ins here -->
    </plugins>
</build>

相关内容

最新更新