R
R
relgames2012-03-28 13:38:45
Java
relgames, 2012-03-28 13:38:45

maven: using a module as a plugin

There is a multi-module maven project with a complex hierarchical structure. One of the modules is used as a plugin in another module.

Doesn't want to compile, can't find this plugin.
Previous developers solved this through mvn install, which was run several times, but I don’t want to, I want to do it normally.

If such a design is impossible in principle, then how to do it right? While this module/plugin depends on some other modules in the same project...

ps
Maven 3.0.4

Answer the question

In order to leave comments, you need to log in

3 answer(s)
J
javax, 2012-03-28
@javax

It's a matter of compilation. If the plugin passes "mvn install" first, then the plugin will find it

1
1nd1go, 2012-03-28
@1nd1go

The idea is the following. mvn install will submit your artifacts to the local repository. Until the right one is there, then, accordingly, it will not be found. Therefore, when you call mvn package, the installation of modules in the local repository does not occur.
In general, I would eschew multi-module projects. Most likely, you can get by with separate artifacts and write them as dependencies. To do this, though, you also need to use the command repository of artifacts.

S
serso, 2012-03-28
@serso

Naturally, Maven can work with modules that depend on each other, but it is important that all modules and their dependencies are correctly written

<groupId>, <artifactId>, <version>, <packaging>/<type>

At the build stage, Maven will show something like:
Scanning for projects...
Reactor build order:
module-a
module-b

from where you can understand how Maven resolved the dependencies.
In your case (when the module is a plugin), to be honest, I don’t know what will happen, but for some reason it seems to me that such a scenario is not provided by the Maven developers. Therefore, it is always possible (and probably necessary) to move this module into a separate project and install it once.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question