Maven WebApp META-INF context.xml

后端 未结 2 1567
抹茶落季
抹茶落季 2021-02-01 07:33

I am using Maven 3 and I am trying to add META-INF folder under webapp folder. So I am trying to do the following:

src
 main
  webapp
   META-INF
    context.xml         


        
相关标签:
2条回答
  • 2021-02-01 08:11

    Use the tag instead. Above answer using copies everything in src/main/resources to the root of your web application, which is probably not what you want to do nor an example you want to follow.

    0 讨论(0)
  • 2021-02-01 08:16

    Put your META-INF folder within src/main/resources.

    Put this on your pom.xml... sorry i missed it before;

    <build>
    <plugins>
        <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.0.0</version>
                <configuration>
    
    
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <classpathPrefix>lib/</classpathPrefix>
                        </manifest>
                    </archive>
    
                    <webResources>
                        <resource>
                            <!-- this is relative to the pom.xml directory -->
                            <directory>${project.basedir}/src/main/resources
                            </directory>
    
                        </resource>
                    </webResources>
    
    
    
                    <warName>mywar</warName>
                </configuration>
            </plugin>
    </plugins>
    </build>
    

    the web resources tag is what is important... Hope this helps

    0 讨论(0)
提交回复
热议问题