Maven libraries in non-maven projects

We have a large non-maven Java project.  As well as this, we also have some smaller Maven projects and an Archiva repository.

I would like to use Maven libraries in the non-Maven project for snapshot and 3rd party dependencies.

I set this up - using 'Maven libraries' as dependencies for the modules in the non-Maven project.  So far so good.  However, there doesn't seem to be a check done for newer versions in Archiva.

For example, if I delete the artifact in my local Maven repository, nothing goes off and downloads it from Archiva (like what would happen if it was a Maven project).  I'm guessing (because I haven't been able to test it yet) that if a newer version existed in Archiva then that wouldn't be picked up either.

Is this expected behaviour?

The non-Maven project also uses Ivy (and we were using IvyIDEA plugin in IDEA), but this wasn't working very well for the snapshot dependencies (it was a mistake to use it I think), so that's why I'm looking into using Maven libraries.  FYI I disabled all Ivy detection for the Maven library experiment.

So is it possible to use Maven libraries and expect to be able to pick up newer versions? That is, expect it to behave like Maven?

Thanks,

3 comments
Comment actions Permalink

timwebster9 wrote:

So is it possible to use Maven libraries and expect to be able to pick up newer versions? That is, expect it to behave like Maven?

No. IDEA generates those maven libraries when it processes a POM. So if it does not process a POM (i.e. "import" or "re-import" it), IDEA will not update the library definition. Your only solution would be to create a POM and import it... perhaps in an external project? (Or, more ideally, convert your non-maven project to maven if possible.)

0
Comment actions Permalink

Hi,

OK thanks for the reply.  I got around it doing pretty much what you suggested - having a POM with all the dependencies in a separate module.  This will manage the libraries

Annoyingly, initially I had the other modules dependent on this Maven module,and within the Maven module I exported its dependencies so the other modules could 'see' them.  this worked, however every time you refreshed the POM by clicking the 'reimport all Maven projects' button in the Maven project panel, all the 'export' tickboxes cleared in the Maven module dependencies.  There are a lot of them as well, (and no 'select all' option).  So this wouldn't work.

In the end I just added the libraries as dependencies to the module that needed them (the non-maven one).  This lets the project see the dependencies, and the Maven module manages them.

And yes, we are in the process of converting to Maven, but it's been a slow process - it's a huge project ( > 1,000,000 lines of code), and budget constraints, business cases, the usual stumbling blocks from the business...:-)

0
Comment actions Permalink

timwebster9 wrote:

And yes, we are in the process of converting to Maven, but it's been a slow process - it's a huge project ( > 1,000,000 lines of code), and budget constraints, business cases, the usual stumbling blocks from the business...:-)

Figured it was something like that ;-) Been there, done that, got the T-shirt.

0

Please sign in to leave a comment.