1

I have a parent pom that define a dependency in dependencyManagement bloc like this

 <dependencyManagement> <dependencies> <dependency> <groupId>com.tibco.plugins</groupId> <artifactId>com.tibco.bw.palette.shared</artifactId> <version>6.1.100</version> </dependency> </dependencies> </dependencyManagement> 

In a child pom I'm using the dependency like this

 <dependencies> <dependency> <groupId>com.tibco.plugins</groupId> <artifactId>com.tibco.bw.palette.shared</artifactId> <scope>provided</scope> </dependency> 

the problem is when I open the project is a custom Eclipse IDE, I have this error, it can't understand that the version is in parent pom

enter image description here

I need some way to reference the version from the parent pom in the child pom without redefining it

thank you

5
  • Can you move tibco plugin artifact directly to the dependency section of parent pom.xml from dependency management. Besides, import the project as Maven project in Eclipse. Commented Oct 2, 2019 at 13:31
  • the project is imported as maven project I can see maven icone, I want to keep dependencies centralized in dependencyManagement, any way to reference the version ? thanks for replay Commented Oct 2, 2019 at 13:36
  • 1
    You can add dependency version in parent pom under properties <properties> <test.version>X.X</test.version> </properties> and reference that with place holders in child. Actually, you can also omit project properties outside of parent which are the same, as they will be inherited from parent. Commented Oct 2, 2019 at 13:43
  • 1
    Your approach with the dependencyManagement is completely correct and Eclipse usually understands that. I guess that your Eclipse needs some "refreshment", like ALT+F5 or restart. Furthermore, try to run a build on your project (e.g. clean verify), this often resolves synchronisation issues. Commented Oct 2, 2019 at 14:02
  • Or you need to check if you have correct parent/child relations in your project... Commented Oct 3, 2019 at 14:17

2 Answers 2

1

Try this ...

In your parent pom

<groupId>my.project</groupId> <artifactId>myproject-parent</artifactId> <version>MYPROJECT-1.0</version> <packaging>pom</packaging> <properties> <com.tibco.bw.palette.shared.version>6.1.100</com.tibco.bw.palette.shared.version> </properties> <dependencyManagement> <dependencies> <dependency> <groupId>com.tibco.plugins</groupId> <artifactId>com.tibco.bw.palette.shared</artifactId> <version>${com.tibco.bw.palette.shared.version}</version> <scope>provided</scope> </dependency> </dependencies> </dependencyManagement> 

Then in your child pom

<parent> <groupId>my.project</groupId> <artifactId>myproject-parent</artifactId> <version>MYPROJECT-1.0</version> <relativePath>..</relativePath> </parent> <groupId>my.project.child</groupId> <artifactId>myproject-child</artifactId> <version>MYPROJECT-1.0</version> <dependencies> <dependency> <groupId>com.tibco.plugins</groupId> <artifactId>com.tibco.bw.palette.shared</artifactId> </dependency> </dependencies> 

It's important that you have your parent / child relationship set-up correctly. Also be aware that dependencyManagement only works one level in the maven hierarchy (i.e it'll not work on "grand children")

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

Comments

0

adding dependency version in parent pom under properties X.X and reference that with place holders in child. Actually, you can also omit project properties outside of parent which are the same, as they will be inherited from parent. – from WhoCares

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.