开发者

changing default structure in maven for war

My project folder structure is different from that of Maven. Can I still use Maven?

If yes .. I want to use webContent folder instead of webapp .. how can i do that?

i already changed java folder to ja开发者_C百科vaSource using .. can anyone help


You can have whatever structure you want and still use maven. Just define directory with your web resources.

<project>
...
<build>
<plugins>
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.1.1</version>
    <configuration>
      <webResources>
        <resource>
          <!-- this is relative to the pom.xml directory -->
          <directory>resource2</directory>
        </resource>
      </webResources>
    </configuration>
   </plugin>
  </plugins>
 </build>
 ...
</project>


Have a look at the war plugin usage page: http://maven.apache.org/plugins/maven-war-plugin/war-mojo.html

In your case, you'll need to set the warSourceDirectory (in a <configuration> tag in the war-<plugin> section) like:

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.6</version>
    <configuration>
      <warSourceDirectory>${project.basedir}/WebContent</warSourceDirectory>
    </configuration>
  </plugin>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜