I am using maven's dependency-management to import the POM into my project Y as below:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.abc</groupId>
<artifactId>X</artifactId>
<version>1.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
And my artifact X has following properties which I want to access in POM of project Y:
<properties>
<property1>value1</property1>
<property2>value2</property2>
</properties>
I am not able to access properties defined in X into Project Y. I understand that using above approach I can't make use of plugin-management but I was unable to find anything related to properties on web.
Also please note I can't use the artifact X as parent as we have project level parent already defined.
Could you please guide on the same.
You can only inherit properties from another pom, if you declare that as a parent. Importing a pom with type
import
only imports its dependencies, as described in the documentation. Since using the other pom as a parent is not possible in your case, let me suggest an alternative:The codehaus Properties Maven Plugin can load maven properties from an external file. It can even use
classpath:
URLs to load files from. So you might try to load those from another dependency (which should have an appropriatescope
since you probably do not want that dependency's JAR to hang around at runtime).