我试图将我的资源复制到类路径中,具体取决于使用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
我知道我可以把他们分开,但如果有共享的(如配置在呈现结构),我怎么能也包括它?