简体   繁体   中英

No classes in war maven

I'm pretty new in using og maven, an I got stuck. mvn clean install does not generate classes :(

I'm using the following code in my pom :

<plugin>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.4</version>
      <configuration>
        <webXml>WebContent\WEB-INF\web.xml</webXml>
        <archiveClasses>true</archiveClasses>
       </configuration>
</plugin>

Please read the usage page first, it will show the expected folder structure. So java sources are expected in src/main/java. BTW: If you still want to use WebContent , set the warSourceDirectory to WebContent , remove all other configuration.

<plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
            <source>1.6</source>
            <target>1.6</target>
            <optimize>true</optimize>
        </configuration>
    </plugin>

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <configuration>
            <webResources>
                <resource>
                    <directory>src/main/webapp</directory>
                    <filtering>true</filtering>
                </resource>
            </webResources>
        </configuration>
    </plugin>
</plugins>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM