0
내 번들 (스프링 동적 모듈 기반의 OSGI)에 속성 파일을 도입하려고합니다. 해당 속성 파일에 데이터베이스 URL, 사용자 이름, 암호 등과 같은 속성을 유지하고 maven이 해당 파일을 읽길 원합니다.Maven에서 응용 프로그램 속성 파일을 읽지 못함
<properties>
<database.username>${development_user}</database.username>
</properties>
<build>
<filters>
<filter>src/main/resources/Application_${env}.properties</filter>
</filters>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<defaultGoal>install</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>bundle</id>
<phase>package</phase>
<goals>
<goal>resources</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.7</version>
<extensions>true</extensions>
<executions>
<execution>
<id>bundle</id>
<phase>package</phase>
<goals>
<goal>bundle</goal>
</goals>
</execution>
</executions>
<configuration>
<excludes>*/pom.</excludes>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
내 Application_local.properties 파일에서 특성 아래에 있습니다 :
development_user=dev_user
하지만 명령 "MVN으로 번들 빌드 할 때 새로 설치
나는 내 POM에서 필터링을 소개하려 -Denv = local "시스템이 내 database.xml의 값으로 $ {development_user}을 (를) 삽입합니다.누군가이 문제를 해결하는 데 도움을 줄 수 있습니까?
는 SRC/메인/자원에 위치한 database.xml가되어보십시오? – UR6LAD