我正在尝试根据构建时选择的配置文件将图像获取到我的 Maven Web 应用程序。但我不断将所有配置文件的整个文件夹放到我需要图像的位置。
<build>
<finalName>user-interface</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webResources>
<webResource>
<directory>src/main/profile/webapp/</directory>
<targetPath>images</targetPath>
</webResource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>user</id>
</profile>
<profile>
<id>dev</id>
</profile>
</profiles>
如何解决这个问题?默认图像是banner.jpg
,并且两个配置文件都以正确的顺序具有各自的图像。里面src/main/profile/webapp/
有 2 个文件夹user
,dev
每个文件夹都有图像文件夹和banner.jpg
内部图像文件夹。