2012-09-12 4 views
5

나는 이클립스를 봄 때 웹 프로젝트를 작성하기 위해 사용하고 있지만 이제는 maven도 살펴보기 시작했다. 이클립스에서 maven으로 멋진 샘플 웹 프로젝트를 만들었지 만 프로젝트를 마우스 오른쪽 버튼으로 클릭하면 더 이상 WAR 파일로 내보낼 수 없습니다. 내 전쟁 파일을 서버에 올려 놓는 방법? 내 pom.xml에 뭔가를 넣어야합니까?이클립스에서 내 maven 프로젝트를 war 파일로 내보내는 방법

<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

당신은 아마 "MVN 패키지"의 출력을 공유 할 수 ... MVN 이클립스 실행 구성에서 목표를 설치 실행할 수있는 실행? – pagid

+0

huh ... Eclipse에서 마우스 오른쪽 버튼을 클릭하여 WAR로 내보낼 수있는 옵션이 있습니다. – PartyWithJohn

답변

5

사용 받는다는 플러그인을 받는다는-컴파일러 플러그인, 받는다는 전쟁 - 플러그인, 예 :

<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> 

좀 도와주세요 .... 내 pom.xml 파일은 다음과 같다 그리고 간단히 :

mvn install 

은 WAR 파일을 생성합니다.

당신은

관련 문제