开发者

How to create a swing application using maven?

I was trying to start new swing application using maven, s开发者_开发百科o 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 :)


Basically, if you are only using Swing (I mean if you do not want additional features such as SwingX for example), then you will not need to add specific information in your pom.xml file, as everything needed for Swing development is already embedded in the JDK.

Concerning the build process, there is also nothing specific additions here. However, you may need be interesed in:

  • Creating an executable JAR.
  • Making a big JAR, that also contains all the dependencies.


Check these links if you have problems finding documentation about maven Better builds with Maven and Maven: The Definitive Guide. Then you will figure out that you can build any kind of app like swing using maven. Maven is not a framework is project management and comprehension tool.

Note: Maven: The Definitive Guide was split into two books. The link goes to the blog post that links to both of them.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜