在我的maven gwt项目中,我想在该项目中生成特定文件夹的war版本。 我在我的pom.xml中有这些代码:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
</plugin>
如何在插件元素中说出我要打的文件夹?
这是我完整的pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>Satra</artifactId>
<groupId>ir.nsdp.satra</groupId>
<version>1.0</version>
</parent>
<groupId>ir.nsdp.satra</groupId>
<artifactId>web</artifactId>
<packaging>war</packaging>
<name>Satra Web</name>
<version>1.0</version>
<prerequisites>
<maven>${mavenVersion}</maven>
</prerequisites>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ir.nsdp.satra.gwt</groupId>
<artifactId>test-client</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>ir.nsdp.satra.gwt</groupId>
<artifactId>test-shared</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version><dependencies>
<dependency>
<groupId>ir.nsdp.satra.gwt</groupId>
<artifactId>test-client</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>ir.nsdp.satra.gwt</groupId>
<artifactId>test-shared</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
<configuration>
<warName>Satra-portlet</warName>
<warSourceDirectory>/opt/pros</warSourceDirectory>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
</archive>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
答案 0 :(得分:2)
您必须按如下所示进行指定:
<warSourceDirectory>src/main/webapp</warSourceDirectory>
有关分步说明,请查看Maven GWT Plugin
在gwt maven war plugin configuration problem找到示例pom.xml
。
- 编辑 -
尝试这个(根据您的要求更换)
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<testSourceDirectory>src/main/test</testSourceDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<!-- http://mojo.codehaus.org/gwt-maven-plugin/compile-mojo.html -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>${gwtVersion}</version>
<executions>
<execution>
<configuration>
<extraJvmArgs>-Xmx640M -Xss1024k</extraJvmArgs>
</configuration>
<goals>
<goal>compile</goal>
<goal>eclipse</goal>
</goals>
</execution>
</executions>
<configuration>
<optimizationLevel>9</optimizationLevel>
<style>DETAILED</style>
<warSourceDirectory>src/main/webapp</warSourceDirectory>
<modules>
<module>com.x.y.z.EntryPointClassName</module>
</modules>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<webXml>src/main/webapp/WEB-INF/web.xml</webXml>
<warSourceExcludes>WEB-INF/lib/*.jar</warSourceExcludes>
</configuration>
</plugin>
...