java - How to bundle a war inside a package/.zip using maven assembly plugin -


my requirement build package(test.zip file) contains test.war , test.properties.

pom.xml

<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>    <groupid>com.karthik</groupid>   <artifactid>test</artifactid>   <packaging>war</packaging>   <version>0.0.1-snapshot</version>    <dependencies>     <dependency>         <groupid>junit</groupid>         <artifactid>junit</artifactid>         <version>3.8.1</version>         <scope>test</scope>     </dependency>     <dependency>         <groupid>org.apache.struts</groupid>         <artifactid>struts2-core</artifactid>         <version>2.3.32</version>     </dependency>   </dependencies>  <build>     <finalname>test</finalname>     <plugins>         <plugin>             <groupid>org.apache.maven.plugins</groupid>             <artifactid>maven-compiler-plugin</artifactid>             <version>3.6.2</version>             <configuration>                 <source>1.8</source>                 <target>1.8</target>             </configuration>         </plugin>         <plugin>                 <artifactid>maven-assembly-plugin</artifactid>                 <executions>                     <execution>                         <id>make-bundles</id>                         <goals>                             <goal>single</goal>                         </goals>                         <phase>package</phase>                         <configuration>                             <descriptors>                                 <descriptor>test-assembly.xml</descriptor>                             </descriptors>                         </configuration>                     </execution>                 </executions>             </plugin>     </plugins>   </build>  

test.assembly.xml

 <assembly     xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"     xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"     xsi:schemalocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">     <formats>         <format>zip</format>     </formats>     <id>test</id>     <includebasedirectory>false</includebasedirectory>     <files>         <file><outputdirectory>.</outputdirectory><source>test.properties</source></file>         <file><outputdirectory>.</outputdirectory><source>test.war</source></file>     </files> </assembly>   

when run mvn package or mvn assembly:assembly, below error :

[info] reading assembly descriptor: test-assembly.xml [info] ------------------------------------------------------------------------ [info] build failure [info] ------------------------------------------------------------------------ [info] total time: 9.116s [info] finished at: tue sep 12 08:28:58 edt 2017 [info] final memory: 36m/355m [info] ------------------------------------------------------------------------ [error] failed execute goal org.apache.maven.plugins:maven-assembly-plugin:2.6:single (make-bundles) on project test: failed create assembly: error adding file archive: c:\dev\eclipse-jee-luna-sr2-win32-x86_64\mavenworkspace\***\test.war -> [help 1] [error] [error] see full stack trace of errors, re-run maven -e switch. [error] re-run maven using -x switch enable full debug logging. [error] [error] more information errors , possible solutions, please read following articles: [error] [help 1] http://cwiki.apache.org/confluence/display/maven/mojoexecutionexception 

the test.war built not getting bundled in test.zip
causing error , how can package test.war in test.zip?

something should trick:

<assembly> ... <files>  <file>   <source>target/${artifactid}.${packaging}</source   <outputdirectory>war</outputdirectory>   <destname>${artifactid}.${packaging}</destname>  </file> </files> 

Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -