Wudong
Wudong

Reputation: 2360

How to implement a Java application which automatically updates based on Maven?

I'm developing a Rich-client Java application and need a feature to do auto update when a new version is available.

I'm using maven for the build. By its own, the maven-dependency-plugin could copy and download dependencies for a given POM. The only problem is how to integrate this inside a Java application.

Has anyone tried this before?

Upvotes: 1

Views: 222

Answers (4)

kisp
kisp

Reputation: 6552

Maven is a configuration management and deployment tool. You need a runtime solution instead of build / compile time. If you have a maven repository central, you should have a downloader to retrieve the latest version from it. For example you can find some scripts how to download an artifact from nexus. Nexus has an own rest api which you can use for it. It is just a tip.

Upvotes: 0

Marcin Szymczak
Marcin Szymczak

Reputation: 11443

For client side you can just write a method which checks for updates after starting an app.

Upvotes: 0

Karthik Prasad
Karthik Prasad

Reputation: 10004

I assume you are speaking about library/jar(dependency). In that case you remove the version. Hence by default maven takes the latest version. But in real scenario, when you move from one version to another version, a regression testing is required because some changes in a version may not work.

Upvotes: 1

Canberk
Canberk

Reputation: 435

I am not sure what kind of application you have or whether you need maven to do this task. First of all, you need to check if there is a newer version available or not. If the there answer if yes, your listener will trigger your updateApplication(assume you name it like this) method. Your method than download the required jars, files or etc.. to appropriated places, replacing the old ones. But like I said, I don't know your architecture, it may not be suitable for every case.

Upvotes: 0

Related Questions