2013-04-25 16 views
7

maven-jetty-plugin ve maven-failsafe-plugin kullanarak entegrasyon testi çalıştırıyorum. i temiz MVN çalıştırdığınızda, iskele sunucu başlar yüklemekSunucu başlatıldıktan sonra jetty sunucusu neden askıda kalıyor ve entegrasyon testini çalıştırmıyor?

<plugin> 
      <artifactId>maven-failsafe-plugin</artifactId> 
      <version>2.7.1</version> 
      <executions> 
       <execution> 
       <id>integration-test</id> 
       <goals> 
        <goal>integration-test</goal> 
       </goals> 
       </execution> 
       <execution> 
       <id>verify</id> 
       <goals> 
        <goal>verify</goal> 
       </goals> 
       </execution> 
      </executions> 
     </plugin> 

     <plugin> 
      <groupId>org.mortbay.jetty</groupId> 
      <artifactId>maven-jetty-plugin</artifactId> 
      <version>6.1.26</version> 
      <configuration> 

        <connectors> 
        <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector"> 
         <port>8080</port> 
         <maxIdleTime>3600000</maxIdleTime> 
        </connector> 
        </connectors> 

       <contextPath>/</contextPath> 
       <scanIntervalSeconds>3</scanIntervalSeconds> 
       <scanTargetPatterns> 
        <scanTargetPattern> 
         <directory>src/main/webapp/WEB-INF</directory> 
         <excludes> 
          <exclude>**/*.jsp</exclude> 
          <exclude>**/*.html</exclude> 
         </excludes> 
         <includes> 
          <include>**/*.page</include> 
          <include>**/*.properties</include> 
          <include>**/*.xml</include> 
         </includes> 
        </scanTargetPattern> 
       </scanTargetPatterns> 
      </configuration> 
      <executions> 
        <execution> 
         <id>start-jetty</id> 
         <phase>pre-integration-test</phase> 
         <goals> 
          <goal>run-war</goal> 
         </goals> 
         <configuration> 
          <scanIntervalSeconds>0</scanIntervalSeconds> 
          <daemon>true</daemon> 
         </configuration> 
        </execution> 
        <execution> 
         <id>stop-jetty</id> 
         <phase>post-integration-test</phase> 
         <goals> 
          <goal>stop</goal> 
         </goals> 
        </execution> 
      </executions> 
     </plugin> 

ve bu hiçbir şey olmuyor sonra (o takılıyor): İşte benim yapılandırma var. Günlüklerimdeki son satır şudur: [BİLGİ] Jetty Server'ı başlattı. Control-c'ye bastığımda, aşağıdaki gibi yazdırır:

2013-04-25 15:24:16.315:INFO::Shutdown hook executing 
2013-04-25 15:24:16.317:INFO::Stopped [email protected]:8080 
2013-04-25 15:24:16.821:INFO:/ca-app:Shutting down log4j 
2013-04-25 15:24:16.821:INFO:/ca-app:Closing Spring root WebApplicationContext 
2013-04-25 15:24:22.108:INFO::Shutdown hook complete[INFO] 
Jetty server exiting. 
[INFO] 
[INFO] --- maven-failsafe-plugin:2.7.1:integration-test (default) @ my-app --- 
[INFO] Failsafe report directory: my-app/target/failsafe-reports 

------------------------------------------------------- 
T E S T S 
------------------------------------------------------- 
Running TestSuite 
There are no tests to run. 

Results : 

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0 

[WARNING] File encoding has not been set, using platform encoding MacRoman, i.e. build is platform dependent! 
[INFO] 
[INFO] --- maven-jetty-plugin:6.1.26:stop (stop-jetty) @ my-app --- 
[INFO] 
[INFO] --- maven-failsafe-plugin:2.7.1:verify (default) @ my-app --- 
[INFO] Killing Jetty 
[INFO] Failsafe report directory: my-app/target/failsafe-reports 
[WARNING] File encoding has not been set, using platform encoding MacRoman, i.e. build is platform dependent! 
[INFO] 
[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ my-app --- 
[INFO] Installing my-app/target/ca-app-0.1.5-SNAPSHOT.war to ~/.m2/....../my-app/0.1.5-SNAPSHOT/my-app-0.1.5-SNAPSHOT.war 
[INFO] Installing my-app/pom.xml to ~/.m2/....../my-app/0.1.5-SNAPSHOT/my-app-0.1.5-SNAPSHOT.war 
[INFO] 
[INFO] --- maven-dependency-plugin:2.1:sources (install) @ my-app --- 

Neden takılıyor? Control-c'ye bastığımda, neden adımların geri kalanını yapıyor? Nasıl düzeltebilirim?

+0

Benzer sorular vardı: http://stackoverflow.com/questions/4759620/entegrasyon-deneyleri-wouldnt-hata emniyeti-maven başlangıç? 1 = rQ. Asker, eminfire-failsafe versiyonunu değiştirmenin problemi çözdüğünü belirtti. Ama benim için çalışmıyor gibi görünüyor. Orada da yorum yaptım. –

+0

Herhangi bir yardım çok takdir edilecektir. –

cevap

1

'u run-war yerine kullanmayı deneyin.

org Tutulma \ dalgakıran \ dalgakıran-maven-plugin \ \ 9.3.0.M2 dalgakıran-maven-plugin-9.3.0.M2.jar \! \ Org \ eclipse \ dalgakıran \ maven \ eklentisi \ üzerinde javadoc itibaren

başladığında AbstractJettyMojo.nonblocking


olsun veya olmasın sunucu blokları belirler. Varsayılan davranış (yanlış), sunucunun web isteklerini ele almaya devam ederken diğer işlemleri duraklatmasına neden olur. Bu, sunucuyla etkileşimli olarak çalışmak niyetiyle başlatıldığında yararlıdır. Bu, iskelesinin davranışı: koş, iskele: run-war, iskelet: run-war patlatılmış hedefleri. Doğruysa, sunucu sonraki kodun yürütülmesini engellemez. Bu, iskelesinin davranışıdır:'u başlatın ve iskelesinin varsayılan davranışı: hedeflerini dağıtın.

<goals> 
    <goal>stop</goal> 
     <goal>start</goal> 
</goals> 

Ve bütün: iskelesi başlatmak için Yani


0

çalıştırmak ekleyin

<plugin> 
    <groupId>org.eclipse.jetty</groupId> 
    <artifactId>jetty-maven-plugin</artifactId> 
    <version>9.2.10.v20150310</version> 
    <configuration> 
     <war>webapp/target/MyWar.war</war> 
     <stopKey>fooKey</stopKey> 
     <stopPort>8081</stopPort> 
     <stopWait>1</stopWait> 
     <httpConnector> 
      <port>8888</port> 
     </httpConnector> 
    </configuration> 
    <executions> 
     <execution> 
      <id>start-jetty</id> 
      <phase>pre-integration-test</phase> 
      <goals> 
       <goal>stop</goal> 
       <goal>start</goal> 
      </goals> 
      <configuration> 
       <scanIntervalSeconds>0</scanIntervalSeconds> 
       <daemon>true</daemon> 
       <stopKey>STOP</stopKey> 
       <stopPort>8866</stopPort> 
      </configuration> 
     </execution> 
     <execution> 
      <id>stop-jetty</id> 
      <phase>post-integration-test</phase> 
      <goals> 
       <goal>stop</goal> 
      </goals> 
      <configuration> 
       <scanIntervalSeconds>0</scanIntervalSeconds> 
       <daemon>true</daemon> 
       <stopKey>STOP</stopKey> 
       <stopPort>8866</stopPort> 
      </configuration> 
     </execution> 
    </executions> 
</plugin>