Currently I'm trying to make maven build task for axis2-based project.
In mypom.xml
i have defined dependency jar file. and i want that when war is building, the jar will be moved to another directory: not in war/web-inf/lib
but to war/web-inf/servicejars
I looked through similar questions on stackoverflow but they didn't helped.
<dependencies>
<d开发者_开发知识库ependency>
<groupId>mycompany</groupId>
<artifactId>MyService</artifactId>
<!-- didnt work for me -->
<!--<properties>-->
<!--<war.target.path>servicejars</war.target.path>-->
<!--</properties>-->
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2</artifactId>
<version>1.5.2</version>
</dependency>
<!-- etc ... -->
</dependencies>
<build>
<finalName>Axis2</finalName>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1</version>
<configuration>
</configuration>
<extensions>true</extensions>
</plugin>
<!--<plugin> Didn't worked too-->
<!--<groupId>org.apache.maven.plugins</groupId>-->
<!--<artifactId>maven-dependency-plugin</artifactId>-->
<!--<version>2.1</version>-->
<!--<executions>-->
<!--<execution>-->
<!--<id>copydep</id>-->
<!--<phase>prepare-package</phase>-->
<!--<goals>-->
<!--<goal>copy-dependencies</goal>-->
<!--</goals>-->
<!--<inherited>false</inherited>-->
<!--<configuration>-->
<!--<includeArtifactIds>MyService</includeArtifactIds>-->
<!--<outputDirectory>$project.build.directory/${project.build.finalName}/web-inf/servicejars</outputDirectory>-->
<!--</configuration>-->
<!--</execution>-->
<!--</executions>-->
<!--</plugin>-->
</plugins>
</build>
Thanks in advance.
Have a look at the Maven assembly plugin. You can do this using the assembly descriptor file and the dir
format. Probably not quite the example your looking for but a good place to start is example they provide with the plugin documentation: http://maven.apache.org/plugins/maven-assembly-plugin/examples/single/including-and-excluding-artifacts.html
And here's a good link to the how the assembly descriptor model looks: http://maven.apache.org/plugins/maven-assembly-plugin/assembly.html
精彩评论