Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to define parent-version in maven as property?

I'm using the following dependency as parent in my maven pom.xml:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.1.6.RELEASE</version>
</parent>

If I define the version as property <version>${spring-boot.version}</version> I'm getting the following error:

Project build error: Non-resolvable parent POM: Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:${spring-boot.version} from http://repo.spring.io/milestone was cached in the local repository, resolution will not be reattempted until the update interval of spring-milestones has elapsed or updates are forced. Original error: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:${spring-boot.version} from/to spring-milestones (http://repo.spring.io/milestone): Illegal character in path at index 85: http://repo.spring.io/milestone/org/springframework/boot/spring-boot-starter-parent/${spring-boot.version}/spring-boot-starter-parent-${spring-boot.version}.pom and 'parent.relativePath' points at wrong local POM

So is it not possible to define the parent version as maven property?

like image 722
membersound Avatar asked Sep 10 '14 10:09

membersound


People also ask

How do you define parent pom?

A parent pom. xml file (or super POM) in Maven is used to structure the project in order to avoid redundancies and duplicate configurations by using an inheritance between different pom. xml files. If any dependency or properties are configured in both - parent and child - pom.


1 Answers

Try updating Maven to 3.2.3. Check these release notes:

  • Maven 3.2.1
  • Maven 3.2.2

There was some work done this front in the latest versions of Maven and it should be possible to do it with version 3.2.1 (at least), but if you're upgrading Maven anyway, go with the latest.

like image 97
carlspring Avatar answered Nov 04 '22 06:11

carlspring