MAVEN packs the generated jar to the specified path at the same time

Source: Internet
Author: User

Related information from hundred | degrees | know | way:

<build>    <outputdirectory>src/main/webapp/web-inf/classes</ outputdirectory>    <testoutputdirectory>src/main/webapp/web-inf/classes</ testoutputdirectory>    <plugins>         <plugin>            <artifactId> maven-antrun-plugin</artifactid>             <executions>                 <execution>                     <id>copy-lib-src-webapps</id>                     <phase>package </phase>    &nbsP;               <configuration >                         <tasks>                             <!-- <delete dir= "Src/main/webapp/web-inf/lib"  />-->                              <copy todir= "${project.web-common.lib-targetpath}" >                                  <fileset dir= "${ Project.commonmodule.lib-source.directory} ">                                      <include name= "*"  />                                  </fileset>                             </copy>                          </tasks>                     </configuration>                     <goals>                          <goal>run</goal>                     </goals>                 </execution>             </executions>        </plugin >    </plugins></build>

Purpose: Copies the packaged jar-generated jars to the specified path
Obstruction: Command MVN package, only to generate the jar packages, if you simply copy files using the resources method, it is not possible to copy a thing that does not exist to a certain place at package time.
Workaround: Add Antrun plugin to change the order of packaging and copying, making it possible to make a copy after packaging.
PS: The path specified in the properties in Project, the module of project is understood to be used.


Maven Combat (ix)--Packaging tips


MAVEN packs the generated jar to the specified path at the same time

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.