Capp Argo
Capp Argo

Reputation: 281

Maven module properties from another module

I have a multi-module project. In one of the modules I'm generating classes from wsdl. In the pom of this module I need some properties of another module. (build.directory, outputDirectory etc)

It something like this possible?

${project.parent.module.0.build.directory}

I think I saw the above somewhere. Didn't bother testing it because doing module.0 would mean it's dependent on the order in which modules are declared in the parent pom.

Is there a elegant way of doing what I want?

Upvotes: 3

Views: 5501

Answers (2)

carlspring
carlspring

Reputation: 32627

The proper way to do this is to have a parent. Define the properties in there and then simply use that as the parent in your other modules. That way you can easily share the properties across your modules.

Upvotes: 2

Ryan Stewart
Ryan Stewart

Reputation: 128849

Maven doesn't provide this kind of access. You could use Groovy via GMaven to parse the other pom as XML and get at what you want.

Upvotes: 0

Related Questions