에서
<profiles>
<profile>
<id>APP_NAME</id>
<properties>
<test.email>USER_EMAIL</test.email>
<test.password>USER_PASSWORD</test.password>
</properties>
</profile>
</profiles>
스 니펫 궁금합니다.
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<build>
그리고 파일 src/main/resources/com/example/your/file.properties
작성 : 자바 액세스 그것에서
testMail = ${test.email}
propertyName = ${maven.variable.name}
:
getClass().getResourceAsStream("/com/example/your/file.properties")
더 이동을, 당신은 maven-enforcer-plugin
으로 test.email
속성의 존재를 적용 할 수 있습니다 :
<build>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>enforce-email-properties</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireProperty>
<property>test.email</property>
<message>
The 'test.email' property is missing.
It must [your free error text here]
</message>
</requireProperty>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</build>
나는 또한 그것을 고려하고 있었지만, 개발자/기고자 중 일부는 repo에 자신의 개인 자격 증명을 위탁한다는 인간적인 요인이 항상 있습니다. 나는 settings.xml이 더 안전한 솔루션이 될 것이지만 –
나는 대답을 완료했다. 당신이 볼 수 있듯이, 자격 증명은'settings.xml' 또는 명령 행에서 설정 될 수있다. – shellholic
+1을 강요합니다. 나는 그 플러그인을 사용할 것이다. –