Maven, projenin POM'undaki özellikleri tanımlamanıza olanak tanır. Aşağıdakine bu benzer bir POM dosyasını kullanarak yapabilirsiniz:
<project>
...
<properties>
<server.url>http://localhost:8080/manager/html</server.url>
</properties>
...
<build>
<plugins>
<plugin>
...
<configuration>
<url>${server.url}</url>
<server>tomcat</server>
</configuration>
...
</plugin>
</plugins>
</build>
</project>
Sen properties
etiketi içinde özelliğini belirterek önlemek ve aynı komut satırından değer iletebilirsiniz:
mvn -Dserver.url=http://localhost:8080/manager/html some_maven_goal
Şimdi, bunları komut satırından belirtmek istemiyorsanız ve bu özellikleri proje POM'undan bir özellik dosyasına ayırmak isterseniz, Properties Maven plugin'u kullanmanız ve initialize phase of the Maven lifecycle numaralı telefondan read-project-properties
hedefini çalıştırmanız gerekir. . Eklenti sayfasından örnek burada üretilir: kullanılmadan olsa
<project>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<!-- Associate the read-project-properties goal with the initialize phase, to read the properties file. -->
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>etc/config/dev.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Bu çalışır! .. Teşekkür ederim!! –