I had to read property shared by a multiple maven project, for this purpose i try to use properties-maven-plugin like :
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-1</version>
<configuration>
<files>
<file>conf.properties</file>
</files>
</configuration>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<distributionManagement>
<snapshotRepository>
<id>snapshots</id>
<url>${nexusurl}</url>
</snapshotRepository>
</distributionManagement>
</project>
and the file conf.properties contains :
nexusurl=http://localhost:8081/nexus/content/repositories/snapshots
the problem is that when using mvn deploy, the property nexusurl is not resolved, and the error trace resulted is :
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy
(default- deploy) on project parent: Failed to deploy artifacts/metadata: No connector
available to access repository snapshots (${nexusurl}) of type default using the
available factories WagonRepositoryConnectorFactory -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute
goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on
project parent: Failed to deploy artifacts/metadata: No connector available to
access repository snapshots (${nexusurl}) of type default using the available
factories WagonRepositoryConnectorFactory
I had tried to change the execution phase of the plugin (validate, install , deploy), changing the verion of the plugin to 1.0-alpha-2, but te problem persist.
I will be thankful of any aid.
Thanks,
The problem is that the pom.xml is read and inteporlated with properties much earlier than your plugin loads. You can use the plugin for values within your build — for example between plugins, but what you’re trying to do will not work like that.