I'm creating two maven plugins in different git repositories and different reactors. in order to ensure both are using same plugins and dependencies versions both are using our corporate pom as its parent.
in that parent pom I created a new conditional profile (exclusive for maven plugins) that is activated by the presence of a file. there I added a dependencyManagement tag:
<profile>
<id>whenIsMavenPluginProject</id>
<activation>
<file>
<exists>.releng.mplugin</exists>
</file>
</activation>
....
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>3.2.3</version>
</dependency>
...
In the plugins I have a dependency tag like the below:
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<scope>provided</scope>
</dependency>
....
Both plugins are being built properly since both contains the needed activation file.
But I'm getting an error when using these plugins in other projects:
[ERROR] Internal error: java.lang.RuntimeException: org.apache.maven.MavenExecutionException: Could not setup plugin ClassRealm: Plugin org.c4biz.tools.maven.indexer:org.c4biz.tools.maven.indexer.plugin:0.2.1-SNAPSHOT or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.c4biz.tools.maven.indexer:org.c4biz.tools.maven.indexer.plugin:jar:0.2.1-SNAPSHOT: 6 problems were encountered while building the effective model for org.c4biz.tools.maven.indexer:org.c4biz.tools.maven.indexer.plugin:0.2.1-SNAPSHOT
[ERROR] [ERROR] 'dependencies.dependency.version' for org.apache.maven:maven-plugin-api:jar is missing. @
[ERROR] [ERROR] 'dependencies.dependency.version' for org.apache.maven.plugin-tools:maven-plugin-annotations:jar is missing. @
[ERROR] [ERROR] 'dependencies.dependency.version' for org.apache.maven:maven-core:jar is missing. @
[ERROR] [ERROR] 'dependencies.dependency.version' for org.codehaus.plexus:plexus-utils:jar is missing. @
[ERROR] [ERROR] 'dependencies.dependency.version' for org.codehaus.plexus:plexus-interpolation:jar is missing. @
[ERROR] [ERROR] 'dependencies.dependency.version' for org.apache.maven:maven-archiver:jar is missing. @
[ERROR] -> [Help 1]
seems that the profile is not being activated and dependencyManagement is not being considered at all.
is there any way to instruct maven to consider the dependencies set inside a conditional profile of a parent project?