我試圖將我的資源複製到類路徑中,具體取決於使用maven選擇哪個配置文件。我的資源文件夾結構如下:具有共享資源的Maven多模塊多配置文件項目
src/main/resources:
config
production
development
staging
我的當前未工作的配置是
<profile>
<id>development</id>
<activation>
<activeByDefault>true</activeByDefault>
<property>
<name>envtype</name>
<value>dev</value>
</property>
</activation>
<build>
<finalName>Corelay</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.xml</include>
<include>**/*.properties</include>
</includes>
<excludes>
<exclude>**/production/**</exclude>
<exclude>**/staging/**</exclude>
</excludes>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/resources</directory>
<includes>
<include>**/*.xml</include>
<include>**/*.properties</include>
</includes>
<excludes>
<exclude>**/production/**</exclude>
<exclude>**/staging/**</exclude>
</excludes>
</testResource>
</testResources>
</build>
</profile>
在所配置/休眠休眠配置文件/休眠-config.xml中請求從同一封裝的一些性質
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath*:**/jdbc.properties</value>
<value>classpath*:**/hibernate.properties</value>
</list>
</property>
</bean>
,但有一個錯誤:
Could not resolve placeholder 'jdbc.driverClassName' in string value "${jdbc.driverClassName}"
該屬性在該文件中定義。怎麼了?另一個問題是如何使從這些配置文件文件夾複製的資源顯示在完全相同的輸出類路徑結構中?我的意思是應該沒有/生產,/開發或/分期:只是/ env
我知道我可以把他們分開,但如果有共享的(如配置在呈現結構),我怎麼能也包括它?