如何使用maven创建一个swing应用程序? [英] How to create a swing application using maven?
问题描述
开始新的swing应用程序,所以我开始搜索maven文档,但是(沮丧地)发现没有线索。所以我问:
- 什么是原型?
- 什么是依赖?
- 如何在maven中构建swing应用程序[是否有插件可以这样做)?
- 什么是原型?
一个swing应用程序是一个标准的JAR,所以只需使用标准原型:
mvn archetype:generate -DgroupId = com.mycompany.app \
-DartifactId = myswingapp \
-Dversion = 1.0-SNAPSHOT
- 依赖关系是什么?
< blockquote>
如果您打算使用标准 Swing API,没有额外的依赖关系来声明。但是,如果您要使用 JGoodies , MiGLayout , SwingX ,< a href =https://flamingo.dev.java.net/ =noreferrer> Flamingo , SwingFX 等,那么你必须添加适当的工件和存储库。但是你的问题没有普遍的答案。
- 如何在maven中构建swing应用程序[有没有插件可以这样做)?
Swing应用程序不是特别的。我可能会考虑使用 Java Web Start (和< a href =http://mojo.codehaus.org/webstart/webstart-maven-plugin/ =noreferrer> Maven Webstart插件)或者也可能是跨平台安装程序,如 IzPack (和 Maven IzPack插件)。但你有时间,你需要一个应用程序之前:)
I was trying to start new swing application using maven, so I started searching on maven documentation but (frustratingly) found no clue. So I'm asking:
- what is the archetype used?
- what are the dependencies?
- how to build swing app in maven [is there is plugin to do so]?
解决方案
- what is the archetype used?
A swing application is a standard JAR so just use the standard archetype:
mvn archetype:generate -DgroupId=com.mycompany.app \ -DartifactId=myswingapp \ -Dversion=1.0-SNAPSHOT
- what are the dependencies?
If you plan to use the standard Swing API only, there aren't no extra dependencies to declare. But if you want to use things like JGoodies, MiGLayout, SwingX, Flamingo, SwingFX etc then you'll have to add the appropriate artifacts and repositories. But there is no universal answer to your question.
- how to build swing app in maven [is there is plugin to do so ]?
A Swing app is not really particular. I would maybe just consider using Java Web Start (and the Maven Webstart plugin) or maybe a cross platform installer like IzPack (and the Maven IzPack Plugin). But you have time for that, you need an application before :)
这篇关于如何使用maven创建一个swing应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!