2016-10-04 3 views
0

Ich benutze Maven, um WAR meiner JEE-Anwendung zu erstellen.Maven entpacken Krieg im Zielordner

Hier mein pom.xml

<finalName>myproject</finalName> 
<sourceDirectory>${basedir}/src</sourceDirectory> 
<plugins> 
    <plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-war-plugin</artifactId> 
    <version>2.5</version> 
    <configuration> 
     <warSourceDirectory>WebContent</warSourceDirectory> 
     <failOnMissingWebXml>false</failOnMissingWebXml> 
     <outputDirectory>/var/www/myproject/webapp</outputDirectory> 
    </configuration>  
    </plugin> 

    <plugin> 
    <inherited>true</inherited> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-compiler-plugin</artifactId> 
    <version>3.2</version> 
    <configuration> 
     <source>1.8</source> 
     <target>1.8</target> 
    </configuration> 
    </plugin> 
</plugins> 

Der erzeugte WAR in Ausgabeordner in pom.xml (/ var/www/myproject/Webapp) definiert kopiert wird, aber dann will ich es starten meinen Server vor auspacken (Kater).

Wie kann ich tun?

Danke, Lorenzo

+0

, warum Sie das wollen auspacken? Tomcat kann die .war-Dateien verarbeiten –

+0

Weil ich "harte" Entwicklungsphase bin und ich überprüfen will, dass Krieg alle benötigten Dateien enthält. – JBerta93

+0

Ihr ' $ {basedir}/src' und ' WebContent' ist eine Garantie für viele Schmerzen und Kopfschmerzen = /. Warum nicht Maven's Konvention benutzen? – Tunaki

Antwort

1

Wenn Sie den Krieg auspacken wollen können Sie Maven Plugin Montage dafür. z.B.

 <plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-dependency-plugin</artifactId> 
     <version>2.10</version> 
     <executions> 
      <execution> 
      <id>unpack</id> 
      <phase>package</phase> 
      <goals> 
       <goal>unpack</goal> 
      </goals> 
      <configuration> 
       <artifactItems> 
       <artifactItem> 
        <groupId>your group id</groupId> 
        <artifactId>your artifact id</artifactId> 
        <version> your version</version> 
        <type>war</type> 
        <overWrite>false</overWrite> 
        <outputDirectory>${project.build.directory}/alternateLocation</outputDirectory> 
        <destFileName>some name</destFileName> 
        <includes>**/*.class,**/*.xml</includes> 
        <excludes>**/*test.class</excludes> 
       </artifactItem> 


</artifactItems> 
      <includes>**/*.java</includes> 
      <excludes>**/*.properties</excludes> 
      <outputDirectory>your location</outputDirectory> 
      <overWriteReleases>false</overWriteReleases> 
      <overWriteSnapshots>true</overWriteSnapshots> 
     </configuration> 
     </execution> 
    </executions> 
    </plugin> 

können Sie auf https://maven.apache.org/plugins/maven-dependency-plugin/examples/unpacking-artifacts.html lesen, um weitere Informationen

Verwandte Themen