You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Luke Gordon <go...@gmail.com> on 2015/01/10 10:53:15 UTC

Maven plugin dependency cannot use parent pom property

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?  I've verified this occurs on each version I've tried so far:
3.0.5, 3.1.1, & 3.2.5

Cheers,

Luke Gordon
gordysc@gmail.com

Re: Maven plugin dependency cannot use parent pom property

Posted by Hervé BOUTEMY <he...@free.fr>.
this should not happen: there is some little mistake somewhere

I just created a little test project to confirm this should not display any 
warning:
https://github.com/hboutemy/property-test

can you share such little project so we can see where is the mistake or 
misunderstanding?

Regards,

Hervé

Le samedi 10 janvier 2015 03:53:15 Luke Gordon a écrit :
> 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?  I've verified this occurs on each version I've tried so far:
> 3.0.5, 3.1.1, & 3.2.5
> 
> Cheers,
> 
> Luke Gordon
> gordysc@gmail.com


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Maven plugin dependency cannot use parent pom property

Posted by Luke Gordon <go...@gmail.com>.
You sir are good!  I'd give 5 stars on this if I could.  I did refactor the
parent module's artifactId and hadn't updated it in the module.  I guess it
was referring to the older version still stored in the local repository.
Updating the parent artifactId did the trick.  Thanks for the fast reply &
fantastic answer!

Cheers,

Luke

On Sat, Jan 10, 2015 at 5:15 AM, Robert Scholte <rf...@apache.org>
wrote:

> 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
>
> Op Sat, 10 Jan 2015 10:53:15 +0100 schreef Luke Gordon <gordysc@gmail.com
> >:
>
>
>  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?  I've verified this occurs on each version I've tried so far:
>> 3.0.5, 3.1.1, & 3.2.5
>>
>> Cheers,
>>
>> Luke Gordon
>> gordysc@gmail.com
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Maven plugin dependency cannot use parent pom property

Posted by Robert Scholte <rf...@apache.org>.
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

Op Sat, 10 Jan 2015 10:53:15 +0100 schreef Luke Gordon <go...@gmail.com>:

> 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?  I've verified this occurs on each version I've tried so far:
> 3.0.5, 3.1.1, & 3.2.5
>
> Cheers,
>
> Luke Gordon
> gordysc@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org