简体   繁体   English

使用Maven pom.xml在WAR中未创建除WEB-INF和META-INF以外的目录

[英]Directory not creating other than WEB-INF & META-INF in WAR using Maven pom.xml

I need to create war for my spring framework project using maven(pom.xml) mvn clean install command. 我需要使用maven(pom.xml)mvn clean install命令为我的spring框架项目创建战争。 My Project SpringMVC folder contains jsp and src folder all folder in src is creating inside the web-inf but i need to create jsp and other folder outside web-inf. 我的Project SpringMVC文件夹包含jsp和src文件夹,src中的所有文件夹都是在web-inf内创建的,但是我需要在web-inf之外创建jsp和其他文件夹。

pom.xml build tag code pom.xml构建标记代码

<build>
    <finalName>SpringMVC</finalName>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
            <webResources>
        <resource>
          <!-- this is relative to the pom.xml directory -->
          <directory>resource2</directory>
          </resource>
          </webResources>
            </configuration>
        </plugin>
    </plugins>
</build>

In war file jsp folder not creating near web-inf. 在war文件的jsp文件夹中,未在web-inf附近创建。 I don't know what else to try. 我不知道还能尝试什么。

My Expected Output Folder Structure 我的预期输出文件夹结构

SpringMVC.war
 |-- META-INF
 |   |-- MANIFEST.MF
 |   `-- maven
 |       `-- com.example.projects
 |           `-- documentedproject
 |               |-- pom.properties
 |               `-- pom.xml
 |-- WEB-INF
 |   |-- classes
 |   |   |-- com
 |   |   |   `-- example
 |   |   |       `-- projects
 |   |   |           `-- SampleAction.class
 |   |   `-- images
 |   |       `-- sampleimage.jpg
 |   `-- web.xml
 |-- external-resource.jpg
 |-- image2
 |   `-- external-resource2.jpg
 |-- index.jsp
 `-- jsp
     `-- websource.jsp

I think you put the jsp's in the wrong directory. 我认为您将jsp放在错误的目录中。

Typicaly the jsp resist in this folder 通常,此文件夹中的jsp抵抗

\ROOT\src\main\webapp

where ROOT is the folder where the pom.xml resist. 其中ROOT是pom.xml阻止的文件夹。

@see also: maven webapp to place jsps in /WEB-INF/jsp @另请参阅: maven webapp将jsps放在/ WEB-INF / jsp中

Need to use maven-antrun-plugin for creating directory and copying files. 需要使用maven-antrun-plugin创建目录和复制文件。

    <plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>generate-locator</id>
<phase>process-sources</phase>
<configuration> 
<tasks>
<mkdir dir="${project.build.directory}/${project.version}/jsp" />
<copy todir="${project.build.directory}/${project.version}/jsp">
<fileset dir="${project.build.directory}/${project.build.finalName}/jsp" />
</copy>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Maven-为什么我的pom.xml没有删除META-INF / *。SF,META-INF / *。DSA和META-INF / *。RSA? - maven - why is my pom.xml NOT removing META-INF/*.SF, META-INF/*.DSA and META-INF/*.RSA? META-INF中的Maven pom.xml与Maven存储库中的pom.xml - Maven pom.xml in META-INF vs pom.xml in Maven repository 为什么不能使用maven-war-plugin将密钥与“ WEB-INF / classes / META-INF / MANIFEST.MF”合并? - Why keys are not merged with “WEB-INF/classes/META-INF/MANIFEST.MF” using maven-war-plugin? Is it possible to have Maven “WAR” pom.xml package up my classes up in a JAR and put the JAR in the /WEB-INF/lib folder? - Is it possible to have Maven “WAR” pom.xml package up my classes up in a JAR and put the JAR in the /WEB-INF/lib folder? 频繁更改pom.xml / maven项目依赖项时,自动更新WEB-INF / lib目录的正确方法是什么? - What's the right way to automatically update WEB-INF/lib directory when pom.xml/maven project dependencies are changed frequently? 可以从WEB-INF \\ lib \\ {*。jar} \\ META-INF \\ resources \\ WEB-INF目录访问tld文件吗? - Can tld files be accessed from WEB-INF\lib\{*.jar}\META-INF\resources\WEB-INF directory? Google App Engine WEB-INF和META-INF - Google App Engine WEB-INF and META-INF gradle可以自动创建META-INF,WEB-INF文件夹和web.xml吗? - Can gradle create META-INF, WEB-INF folder and web.xml automatically? 使用ant war任务将文件包含在WEB-INF目录中 - Using ant war task to include files in WEB-INF directory 来自lib的jar中的META-INF中的CDI WELD Beans.xml阻止了项目的WEB-INF中的一个 - CDI WELD Beans.xml in META-INF from jar in lib blocking the one in WEB-INF of project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM