如何使用maven创建一个swing应用程序? [英] How to create a swing application using maven?

查看:1864
本文介绍了如何使用maven创建一个swing应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆