2014-04-17 2 views
0

나는 maven-jetty-plugins을 사용하고 있습니다. 테스트 및 개발을 위해 두 개의 프로필을 만들었습니다. 내가 부두를 실행할 때 여기, 내 치어 그래서다른 maven 프로필에서 부두를 실행하는 방법

<profiles> 
     <profile> 
     <id>test</id> 
     <build> 

    <finalName>Authorization</finalName> 
     <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-antrun-plugin</artifactId> 
      <version>1.1</version> 
      <executions> 
       <execution> 
        <phase>test</phase> 
        <goals> 
        <goal>run</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin> 
     <plugin> 
     <groupId>org.mortbay.jetty</groupId> 
     <artifactId>maven-jetty-plugin</artifactId> 
     <version>6.1.10</version> 
     <configuration> 
      <scanIntervalSeconds>10</scanIntervalSeconds> 
      <connectors> 
      <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector"> 
       <port>8080</port> 
       <maxIdleTime>60000</maxIdleTime> 
      </connector> 
      </connectors> 
     </configuration> 
     </plugin> 
     </plugins> 
     </build> 
     </profile> 
     <profile> 
     <id>development</id> 
     <build> 

    <finalName>AuthorizationTest</finalName> 
     <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-antrun-plugin</artifactId> 
      <version>1.1</version> 
      <executions> 
       <execution> 
        <phase>test</phase> 
        <goals> 
        <goal>run</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin> 
     </plugins> 
     </build> 
     </profile> 
    </profiles> 

입니다 : 실행은 내가 테스트 및 개발을 위해 프로필 싶다.

부두처럼 : -Pdevelopment 실행 테스트 프로필과 부두에 대한 -Ptest를 실행합니다.

부두를 실행할 때 : 실행 - 테스트가 작동하지 않습니다. 실행하려면 추가 구성이 필요합니까?플러그인에서 가능하지 않은 경우 다른 메이븐 프로필에서 부두를 실행할 수있는 대안이 있습니까? 도와주세요.

답변

1

단계에 부두 플러그를 연결하지 않았거나 실행 목표를 지정하지 않았습니다. 다른 많은 플러그인과는 달리, jetty-maven-plugin의 목표는 기본 단계에 연결되지 않습니다. BTW : 절망적으로 오래된 버전의 jetty-plugin을 사용하고 있습니다. 그때부터, 그것은 저축 기초에서 일식 기초로 옮겨졌고 중요한 개조를 받았습니다 - 적어도 한 번. 나는 아래에 따라 예를 조정 한 :

<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/xsd/maven-4.0.0.xsd"> 
<modelVersion>4.0.0</modelVersion> 
<groupId>org.mwmahlberg.examples</groupId> 
<artifactId>start-jetty-in-profiles</artifactId> 
<version>0.0.1-SNAPSHOT</version> 
<!-- Adjust to your packaging here --> 
<packaging>pom</packaging> 

<profiles> 
    <profile> 
    <id>test</id> 
    <build> 
    <plugins> 
     <plugin> 
     <groupId>org.eclipse.jetty</groupId> 
     <artifactId>jetty-maven-plugin</artifactId> 
     <executions> 
      <execution> 
      <!-- this will fire up jetty as soon as you reach the integration-test phase in the test profile --> 
      <phase>integration-test</phase> 
      <goals> 
       <goal>run</goal> 
      </goals> 
      </execution> 
     </executions> 
     <configuration> 
      <scanIntervalSeconds>10</scanIntervalSeconds> 
      <connectors> 
      <connector implementation="org.eclipse.jetty.nio.SelectChannelConnector"> 
       <port>8080</port> 
       <maxIdleTime>60000</maxIdleTime> 
      </connector> 
      </connectors> 
     </configuration> 
     </plugin> 
    </plugins> 
    </build> 
    </profile> 

    <profile> 
    <id>development</id> 
    </profile> 
</profiles> 
</project> 
0

내가 내 IntelliJ에 새로운 받는다는 명령에 정의 된, 다음과 같은 : 그것은 작동해야

clean package jetty:run -Pdev 

! 프로필 dev는 개발 단계에서 구성 파일의 params를 대체하는 데 사용되었습니다.

<groupId>org.mortbay.jetty</groupId> 
<artifactId>jetty-maven-plugin</artifactId> 
<version>7.4.5.v20110725</version> 
:

나는 여전히 mortbay에서 부두 플러그인을 사용

관련 문제