2

I'm hitting a weird edge use case with Maven & curious why it's behaving the way it does.

I'm defining a property in my parent project like so:

 <properties> <some.property.version>1.0.0.0</some.property.version> </properties> 

Now, in a module, I set a version of a dependency for a plugin like so:

 <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>bob</artifactId> <version>1.0.0.0</version> <dependencies> <dependency> <groupId>org.example</groupId> <artifactId>example</artifactId> <version>${some.property.version}</artifactId> </dependency> </dependencies> </plugin> </plugins> </build> 

This causes Maven to spit out an error:

[ERROR] 'build.plugins.plugin[org.apache.maven.plugins:bob].dependencies.dependency.version' for org.example:example:jar must be a valid version but is '${some.property.version}'. @ line 350, column 16

What's bizarre to me is if I move the property being defined down into the module itself, Maven compiles just fine. Is this a bug? Or are there restrictions of visibility to parent pom properties in a plugin for a module?

1
  • On a second thought, this is probably best served on a mailing list...will update this later with feedback from the Maven folks! Commented Jan 10, 2015 at 9:55

1 Answer 1

1

An insanely fast response from the Apache Maven's distribution list! The parent pom had been refactored, and the module was pointing to the stale parent's artifactId. Kudos to Robert!

Hi,

This makes me wonder if the "right" parent is used, so please double check the groupId, artifactId and version. If both parent and module are part of the same multi-module, be sure that the relativePath is correct (defaults to ../pom.xml) You could also use "mvn org.apache.maven.plugins:maven-help-plugin:2.2:effective-pom" to verify that the property is really there with the expected value. If this is all as expected, then it seems to be a bug.

thanks, Robert

Sign up to request clarification or add additional context in comments.

2 Comments

@RobertScholte incase the dependencies in plugin are being managed by the parent, can we specify it without the version as we do it for project dependency. The plugin dependencies are not being resolved when tried ` 'build.plugins.plugin[com.mysema.querydsl:querydsl-maven-plugin].dependencies.dependency.version' for ch.qos.logback:logback-classic:jar is missing. @ line 95, column 18`
All used plugins must be fully resolved before Maven can start the build. So you cannot use project dependencies as plugin dependencies, they simply have different purposes.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.