Ner*_*ron 1 maven-2 weblogic directory-structure war classpath
我在安装mvn后将weblogic.xml放在WEB-INF文件夹下时遇到问题.我的weblogic.xml文件在src/main/resources/weblogic.xml下,我希望它在安装后放在WEB-INF下.(顺便打包是"战争")
我试过这个:
<resources>
<resource>
<directory>src/main/resources</directory>
<targetPath>../resources</targetPath>
<excludes><exclude>web.xml</exclude><exclude>weblogic.xml</exclude></excludes>
</resource>
<resource>
<directory>src/main/resources/config</directory>
<targetPath>..</targetPath>
<includes><include>weblogic.xml</include></includes>
</resource>
</resources>
Run Code Online (Sandbox Code Playgroud)
它正在使用安装,但是当我想要使用eclipse:eclipse的类路径时,它会给出错误:
说明资源路径位置类型无法在输出文件夹'ResponseManager/target/WEB-INF'内嵌套输出文件夹'ResponseManager/target/WEB-INF/resources'ResponseManager构建路径构建路径问题
因为classpath中的这个conf:
<classpathentry kind="src" path="src/main/resources" output="target/WEB-INF/resources" excluding="web.xml|weblogic.xml|**/*.java"/>
<classpathentry kind="src" path="src/main/resources/config" output="target/WEB-INF" including="weblogic.xml" excluding="**/*.java"/>
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
通常,src/main/resources
get 文件在已编译的类文件中打包,放在它们将被放入的webapp中WEB-INF/classes
.你有什么理由不能把它们放在标准路径下src/main/webapp
吗?
如果您需要打包不在src/main/webapp
文件夹中的其他文件,那么最好在war插件中配置这些资源,如下所示:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1</version>
<configuration>
<webResources>
<resource>
<directory>src/main/config</directory>
<targetPath>WEB-INF</targetPath>
<includes>
<include>weblogic.xml</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
应该可以指定targetPath
如上所述,但我认为在源文件夹中重现想要的目录结构会更清晰.
归档时间: |
|
查看次数: |
3925 次 |
最近记录: |