更新时间:2023-09-19 20:00:16
如果你使用eclipse,你可以按照你的要求采用以下方式之一。
If you you are using eclipse you can follow one of the below ways as per your requirements.
要导出项目您正在以罐子形式工作:
1)右键单击您正在运行的项目>从上下文菜单中选择导出。
1) Right Click on the project you are working > Select Export from context menu.
2)选择Java> JAR文件
2) Select Java > JAR File
3)选择要导出为JAR的项目。输入生成jar文件的名称,然后单击完成。
3) Select the project to export as JAR. Enter the name for the generating jar file and then click on finish.
如果您正在使用Maven,请对pom.xml执行以下配置
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.xxxxx.xxxxx</mainClass>
</manifest>
</archive>
<outputDirectory>C:\tmp</outputDirectory>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<outputDirectory>C:\tmp</outputDirectory>
</configuration>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>