English 中文(简体)
Using maven to distribute a swing application that can have each dependency individually tracked
原标题:

I m moving my project to Maven and eventually OSGi. I currently distribute the project is a large Zip file with all the dependencies. Although my projects code is only 20% of the total package I have to redistribute all the dependency. With smaller independent modules this may be even less.

Looking here on stack overflow it seems that to keep my current plan the maven-assembly-plugin should do the trick.

I was considering having a base installer that would look at a XML manifest, then collect all the libraries that needed to be updated. This would mean that libraries that change occasionally would be downloaded less often. This also makes since for something like OSGi plugins (which could have independent release schedules). In essence I want my software to look and manage individual libraries, and download on demand (based on the manifest).

I was wondering if there is a "maven way" of generating this Manifest and publishing all the libraries to a website? I believe the deploy life-cycle would do the second step.

As an alternative, is there a OpenSource Java library that does this type of deployment? I don t want to embed Maven or something larger with the distributed code. The application is not for coders, the simpler the better, and the smaller the installer the better.

问题回答

It seems like this is a perfect case for Java Web Start, particularly since you re already thinking of keeping the dependencies on a webserver. I don t know if Maven has a WS plugin; I remember writing code for Maven 1 to do the job.

If you d like to see WebStart in action, I recommend the FindBugs demo page: http://findbugs.sourceforge.net/demo.html -- you ll see a link in the second paragraph.

First: Web Start could solve your problem. And here is the documentation for the maven plugin.

Second: Be sure that you

  1. create a keystore like this:

    keytool -genkey -alias timefinder -keystore timefinder.jks

  2. Create a jnlp template like this

  3. look at the bottom of my pom.xml for an example

  4. and call maven via:

    mvn install webstart:jnlp

Advantages:

  • it will do all for you
  • it can create pack200 files for you (extremly compressed jars)
  • it will handle download on demand for you if you have a servlet installed on the download server. Here for more information

Disadvantages:

Another distribution option might be one jar

I don t know a maven way to do the first thing you are describing (which doesn t mean there is nothing for this).

As an alternative, I d use IzPack (which is really a great piece of sotware) and the IzPack Maven Plugin to generate a cross-platform installer and install/deploy it to a maven repository.

EDIT: Maybe have a look at the advanced feature call Web Installers. I don t think it will solve entirely your problem though (downloading only what changed between updates/reinstall).

You can use Maven versions plugin to check and/or update versions of dependencies.





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签