Maven - Reading a property from an external properties file

独自空忆成欢 提交于 2019-11-27 22:50:05

The initialize phase is not part of the clean lifecycle. You need to also bind your properties plugin to pre-clean phase.

However, the dependency resolution runs before resolving and executing other plugins, so your approach won't work.

The proper way to deal with that would be to move dependency versions into a parent pom.xml and use the same parent pom in both of your projects.

u can define like this:

<plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>properties-maven-plugin</artifactId>
            <version>1.0-alpha-2</version>
            <executions>
                <execution>
                <id>pre-clean-config</id>
                    <phase>pre-clean</phase>
                    <goals>
                        <goal>read-project-properties</goal>
                    </goals>
                    <configuration>
                        <files>
                            <file>config.properties</file>
                        </files>
                    </configuration>
                </execution>
                <execution>
                <id>initialize-config</id>
                    <phase>initialize</phase>
                    <goals>
                        <goal>read-project-properties</goal>
                    </goals>
                    <configuration>
                        <files>
                            <file>config.properties</file>
                        </files>
                    </configuration>
                </execution>
            </executions>
        </plugin>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!