2012-09-12 12 views
5

Utilizzo da tempo Eclipse per scrivere progetti Web in sorgenti ma ho appena iniziato a guardare anche Maven. Ho fatto un bel progetto di esempio con Maven in Eclipse, ma se clicco con il tasto destro sul progetto non posso più esportare in un file WAR. come faccio a creare il mio file di guerra sul server? devo mettere qualcosa nel mio pom.xml.Come esportare in un file di guerra il mio progetto di maven in eclissi

please help me .... il mio pom.xml è il seguente:

<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>org.springsource.greenbeans.maven</groupId> 
    <artifactId>WebFlowTemplate</artifactId> 
    <packaging>war</packaging> 
    <version>0.0.1-SNAPSHOT</version> 
    <name>WebFlowTemplate Maven Webapp</name> 
    <url>http://maven.apache.org</url> 
    <dependencies> 

     <dependency> 
      <groupId>jstl</groupId> 
      <artifactId>jstl</artifactId> 
      <version>1.2</version> 
     </dependency> 

     <dependency> 
      <groupId>org.hibernate</groupId> 
      <artifactId>hibernate-core</artifactId> 
      <version>3.6.3.Final</version> 
     </dependency> 

     <dependency> 
      <groupId>org.hibernate</groupId> 
      <artifactId>hibernate-validator</artifactId> 
      <version>4.3.0.Final</version> 
     </dependency> 

     <dependency> 
      <groupId>junit</groupId> 
      <artifactId>junit</artifactId> 
      <version>3.8.1</version> 
      <scope>test</scope> 
     </dependency> 

     <dependency> 
      <groupId>org.aspectj</groupId> 
      <artifactId>aspectjtools</artifactId> 
      <version>1.6.2</version> 
     </dependency> 

     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-aspects</artifactId> 
      <version>3.1.2.RELEASE</version> 
     </dependency> 

     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-context</artifactId> 
      <version>3.1.2.RELEASE</version> 
     </dependency> 

     <dependency> 
      <groupId>org.springframework.webflow</groupId> 
      <artifactId>spring-webflow</artifactId> 
      <version>2.3.1.RELEASE</version> 
     </dependency> 

     <dependency> 
      <groupId>org.springframework.security</groupId> 
      <artifactId>spring-security-core</artifactId> 
      <version>3.1.2.RELEASE</version> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework.security</groupId> 
      <artifactId>spring-security-web</artifactId> 
      <version>3.1.2.RELEASE</version> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework.security</groupId> 
      <artifactId>spring-security-config</artifactId> 
      <version>3.1.2.RELEASE</version> 
     </dependency> 

     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-aop</artifactId> 
      <version>3.1.2.RELEASE</version> 
     </dependency> 


     <dependency> 
      <groupId>log4j</groupId> 
      <artifactId>log4j</artifactId> 
      <version>1.2.17</version> 
     </dependency> 



    </dependencies> 
    <build> 
     <finalName>WebFlowTemplate</finalName> 
    </build> 
</project> 
+0

Potrebbe forse condividere l'uscita del "pacchetto mvn" esegue? – pagid

+0

eh ... di cui sto parlando in Eclipse avevo l'opzione di fare clic con il tasto destro del mouse ed esportare in WAR – PartyWithJohn

risposta

5

Usa Maven plugin Maven-compiler-plugin, Maven-guerra-plugin, es:

<build> 
    <plugins> 
     ... 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <version>2.0.2</version> 
      <configuration> 
       <source>1.6</source> 
       <target>1.6</target> 
       <encoding>${project.build.sourceEncoding}</encoding> 
       <showWarnings>true</showWarnings> 
       <showDeprecation>true</showDeprecation> 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-war-plugin</artifactId> 
      <version>2.1-beta-1</version> 
      <configuration> 
       <failOnMissingWebXml>false</failOnMissingWebXml> 
       <webappDirectory>${project.build.directory}/${project.artifactId}</webappDirectory> 
       <warName>${project.artifactId}_${noVer}</warName> 
       <archive> 
        <addMavenDescriptor>false</addMavenDescriptor> 
        <manifest> 
         <addClasspath>false</addClasspath> 
        </manifest> 
        <manifestEntries/> 
        <manifestFile/> 
       </archive> 
      </configuration> 
     </plugin> 
     ... 
    </plugins> 
    <finalName>${project.artifactId}-${project.version}</finalName> 
</build> 

E poi semplicemente:

mvn install 

creerà il file WAR.

È possibile eseguire mvn installare gol di configurazioni run eclissi ...

Problemi correlati