2

I am trying to read the versions of the dependencies from the external properties file using "properties-maven-plugin",but the properties are still not getting resolved.

I have tried keeping the phase to pre-clean as well as initialize but it is still not working.

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>properties-maven-plugin</artifactId>
  <version>1.0.0</version>
  <executions>
    <execution>
      <phase>initialize</phase>
      <goals>
        <goal>read-project-properties</goal>
      </goals>
      <configuration>
        <files>
          <file>D:\workspace\dev.properties</file>
        </files>
      </configuration>
    </execution>
  </executions>
</plugin>

<properties>
  <acc.version>${acc.version}</acc.version>
</properties>

<dependency>
  <groupId>com.acc</groupId>
  <artifactId>accounting</artifactId>
  <version>${acc.version}</version>
</dependency>

dev.properties file:

acc.version=1.0
barbsan
  • 3,418
  • 11
  • 21
  • 28
  • Possible duplicate of [How to use properties-maven-plugin?](https://stackoverflow.com/questions/30164134/how-to-use-properties-maven-plugin) – J Fabian Meier Jun 17 '19 at 09:12
  • See the link why this is not possible. – J Fabian Meier Jun 17 '19 at 09:12
  • Is there any other plugin to do this? And as the documentation of the properties-maven-plugin plugin says it is used to read/write project properties from/to an external file. Then what is the usage of this plugin? – amrita chauhan Jun 19 '19 at 05:11
  • 1
    The answer https://stackoverflow.com/a/14727072/1707491 explains thoroughly the order in which Maven resolves different things (properties, profiles etc.). The quintessence: Properties which are set by plugins can be used in the configuration of other plugins/reports, but nowhere else. So a plugin can never set a property that should be used in a dependency. – J Fabian Meier Jun 19 '19 at 06:19

0 Answers0