[英]Compile folder with .java files and Jar it
I'm trying to figure out compiling a folder with Java source files in it. 我试图找出一个包含Java源文件的文件夹。 There's a folder structure (root folders are org.AppName.i18n and META-INF).
有一个文件夹结构(根文件夹是org.AppName.i18n和META-INF)。 Eventually I need to get a Jar with the same structure and .java's converted to .class'es.
最终,我需要获得一个具有相同结构的Jar,并将.java转换为.class'es。 Any hints how to make it?
有任何提示如何制作吗? I'm on Windows.
我在Windows上。
您可以为此使用Ant: http : //ant.apache.org/
A build tool, like Gradle is perfect for this. 像Gradle这样的构建工具是完美的选择。
See the tutorial for java projects . 请参阅有关Java项目的教程 。
Create a build.gradle file, where you use the java plugin : 创建一个build.gradle文件,在其中使用java插件 :
apply plugin: 'java'
You either need to move your java files to src/main/java, or specify the source folder in build.gradle, something like this: 您需要将Java文件移动到src / main / java,或者在build.gradle中指定源文件夹,如下所示:
sourceSets {
main {
java {
srcDir 'src/java'
}
resources {
srcDir 'src/resources'
}
}
}
Then run 'gradle jar' 然后运行“ gradle jar”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.