unpack war file after maven clean package -
unpack war file after maven clean package -
i utilize maven-assembly-plugin create war file under [app-root]/target/my-project-war. how unpack war file becomes folder under application root [app-root]/war?
the reason want war folder instead of target/**.war can utilize mvn gae:deploy deploy straight app engine. gae:deploy maven-gae-plugin , confirguration allows me specify appdir, not war file.
pom.xml
<plugin> <groupid>net.kindleit</groupid> <artifactid>maven-gae-plugin</artifactid> <version>${gae.plugin.version}</version> <configuration> <unpackversion>${gae.version}</unpackversion> <serverid>appengine.google.com</serverid> <sdkdir>${gae.home}</sdkdir> <appdir>${basedir}/war</appdir> <splitjars>true</splitjars> </configuration> </plugin> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-assembly-plugin</artifactid> <version>2.2.1</version> <configuration> <appendassemblyid>false</appendassemblyid> <descriptors> <descriptor>${basedir}/assembly-war.xml</descriptor> </descriptors> </configuration> <executions> <execution> <id>make-assembly</id> <phase>package</phase> <goals> <goal>single</goal> </goals> </execution> </executions> </plugin>
assembly-war.xml
<assembly> <id>war</id> <formats> <format>war</format> </formats> <includesitedirectory>false</includesitedirectory> <includebasedirectory>false</includebasedirectory> <filesets> ... </filesets> <dependencysets> </dependencysets> </assembly>
here project folder. war folder in bold.
$ ls -l test-maven-play-plugin/ total 24 drwxr-xr-x 5 angeloh staff 170 jan 25 21:45 app -rw-r--r--@ 1 angeloh staff 2962 jan 25 23:58 assembly-war.xml drwxr-xr-x 6 angeloh staff 204 jan 25 21:46 conf drwxr-xr-x 26 angeloh staff 884 jan 25 22:42 lib -rw-r--r--@ 1 angeloh staff 7380 jan 26 00:05 pom.xml drwxr-xr-x 4 angeloh staff 136 jan 26 00:04 precompiled drwxr-xr-x 5 angeloh staff 170 jan 25 21:45 public drwxr-xr-x 9 angeloh staff 306 jan 26 00:04 target drwxr-xr-x 6 angeloh staff 204 jan 25 22:11 test drwxr-xr-x 3 angeloh staff 102 jan 25 22:15 test-result drwxr-xr-x 2 angeloh staff 68 jan 26 00:04 tmp drwxr-xr-x 3 angeloh staff 102 jan 25 22:10 **war**
----------------------[update]----------------------
a little progress. if these changes:
pom.xml
<plugin> <groupid>org.apache.maven.plugins</groupid> ...... <configuration> ...... <outputdirectory>${basedir}/war</outputdirectory> </configuration> ...... </plugin>
assembly-war.xml
<assembly> <id>war</id> <formats> <format>dir</format> </formats> ...... </assembly>
the war content output war/test-play-1.0.0. however, want straight war, not war/test-play-1.0.0.
----------------------[update]----------------------
finally, after made these changes, works me.
pom.xml
<plugin> <groupid>org.apache.maven.plugins</groupid> ...... <configuration> ...... <outputdirectory>${basedir}</outputdirectory> <finalname>war</finalname> </configuration> ...... </plugin>
the maven-war-plugin builds web app directory first. default directory ${project.build.directory}/${project.build.finalname}
(see webappdirectory configuration property).
the maven-gae-plugin deploys unpacked war. default, same directory. (see appdir configuration property)
so should able run:
mvn clean bundle gae:deploy
if have problems that, consider using war:inplace goal, re-create class files , resources src/main/webapp/web-inf/classes, , dependencies src/main/webapp/web-inf/lib.
maven maven-plugin maven-3 maven-assembly-plugin maven-gae-plugin
Comments
Post a Comment