快速問題:如何在使用Java編譯/構建項目時將NetBeans
配置爲將jar文件(我正在使用sqlite.jar
用於我的應用程序)複製到output folder
?在Java編譯/構建項目時將jar複製到輸出文件夾
0
A
回答
1
在NetBeans中,切換到「文件」選項卡。擴展您的項目(即將要構建的項目)。
雙擊build.xml
。
有很多,你可以重寫構建目標......在build.xml
文件他們,但這裏是轉儲
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar: JAR building
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="LED-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
我可能會建議-post-jar
如果您還沒有這樣做,我會成爲農場與Ant copy
task
1
使用Ant構建。與使用ide製作jar相比,它更好用
相關問題
- 1. (Eclipse)在構建項目時掛起:將資源複製到輸出文件夾
- 2. Teamcity MSBuild將構建輸出複製到新文件夾
- 3. Java - 複製Jar文件夾
- 4. Gradle - 將jar複製到項目文件夾
- 5. 使用Maven構建spring-boot項目時將文件複製到jar根
- 6. 構建Java Derby項目的jar文件時出錯
- 7. 在運行時將文件複製到Android/Java項目文件夾
- 8. 將文件夾結構複製到目標文件夾
- 9. TFS構建輸出未複製到放置文件夾
- 10. 空的.net項目只是爲了將文件複製到輸出文件夾?
- 11. 輸出庫項目XML到asp.net bin文件夾的構建?
- 12. 編譯Maven項目時將文本文件移動到目標文件夾中
- 13. 如何在編譯java項目時找出實際使用的jar文件
- 14. 在構建時(Visual Studio 2013)將項目的全部內容複製到另一個項目的文件夾
- 15. Eclipse動態web項目/構建文件夾/編譯
- 16. 將stderr編譯輸出複製到分隔文件中
- 17. 構建C#visual studio項目時複製和編輯.ini文件
- 18. 如何在目標文件夾存在時將子項目複製到目標?
- 19. 將兩個VS2010 C++項目構建到同一個輸出文件夾中
- 20. 將目錄從jar複製到本地文件夾
- 21. MSBuild將依賴項目的輸出複製到另一個文件夾
- 22. Eclipse何時將資源複製到輸出文件夾?
- 23. 編譯/構建Google App Engine Java項目
- 24. Java編譯器不創建.jar文件
- 25. TFS構建將複製項目文件到測試服務器
- 26. 在編譯Asp.net Core 1.0項目時複製文件
- 27. 如何將文件複製到xcode項目但不復制到根文件夾
- 28. Eclipse PDE構建插件輸出一些文件夾是jar-ed
- 29. 如何在netbean項目中創建的jar文件在建立後立即複製到某個文件夾?
- 30. 使用Maven將包從jar複製到web項目的資源文件夾
呃...我不認爲這就是我需要的。我只需要將另一個jar和我編譯的文件一起復制到輸出文件夾。 – NewProger
Netbeans使用Ant作爲構建器 – MadProgrammer