比如有一个java文件,import了一些java文件,有没有自动化的方法把所有相关的java都打到一个jar包
最终是自己写了个小程序搞定的
你都把maven当做标签了 为啥不用maven呢?
可以使用Maven的maven-assembly-plugin插件或maven-shade-plugin插件,打成的jar包会带有所有依赖。可以参考我的一篇博客:http://xxgblog.com/2015/08/07/maven-create-executable-jar/
可以直接使用maven 我之前些工具包就是用的maven
maven挺好用的啊
给你一个参考
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<build>
<finalName>greys-core</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>attached</goal>
</goals>
<phase>package</phase>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.github.ompc.greys.core.GreysLauncher</mainClass>
</manifest>
</archive>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
使用ant构建工具,可以配置自动化编译的。
发现个博文不错,分享下:https://.com/a/1190000005155826