2012-06-12 2 views
0

현재 부두 버전 6 (mortbay)과 8 (eclipse) 서버에서 실행되는 Java 응용 프로그램을 개발 중입니다.maven 's eclipse jetty plugin + context deployer

나는 지금 프로젝트를 조금 바쁘게 유지하고 있으며, 버전을 계속해서 업그레이드하고 부두의 환경에서 실행되는 통합 테스트를 추가하여 프로젝트에 maven을 통합 할 것을 고려했습니다. 나는 이미 기초적인 프로젝트였습니다. 그 프로젝트를 maven 프로젝트로 변환 할 수 있었고 완벽하게 실행되는 것 같습니다.

유일한 문제는 내 프로젝트의 한 기능에 대한 Maven의 부두 플러그인에 컨텍스트 배포자를 실제로 추가해야한다는 것입니다. mortbay의 jetty.xml 구성 파일과 eclipse의 jetty.xml을 비교하여 저당 베이의 버전에 컨텍스트 배포자가 포함되어있는 반면 컨텍스트 배포자의 징후가없고 해당 구성이 jetty-contexts.xml에 지정되어있는 것으로 나타났습니다.

maven 및 jetty xml configs가 작동하는지 확인하려고했습니다.

내가 노력 것들의 목록입니다 2012- :
<plugin> 
    <groupId>org.mortbay.jetty</groupId> 
    <artifactId>jetty-maven-plugin</artifactId> 
    <version>8.1.0.RC5</version> 
     <configuration> 
      <jettyConfig>jetty.xml</jettyConfig> 
      <jettyConfig>jetty-contexts.xml</jettyConfig> 
    </configuration> 
</plugin> 

이 다음과 같은 오류 메시지가 준 : 다음과 같이

  1. 는 pom.xml 파일에 부두 - contexts.xml 추가 06-12 11 : 04 : 15.182 : 경고 : oejx.XmlConfiguration : 에서 구성 오류 java.lang.IllegalStateException : id = DeploymentManager에 대한 개체가 없음

  2. 나는 http://wiki.eclipse.org/Jetty/Feature/ContextDeployer을 읽고 다음과 같은 설정 추가 :

    <Ref id="DeploymentManager"> 
        <Call name="addAppProvider"> 
         <Arg> 
          <New class="org.eclipse.jetty.deploy.providers.ContextProvider"> 
           <Set name="monitoredDir"><Property name="jetty.home" default="."/>/contexts</Set> 
           <Set name="scanInterval">1</Set> 
          </New> 
         </Arg> 
        </Call> 
    </Ref> 
    

    이 같은 오류 메시지가 준 : 2012-06-12 11시 4분을 다음과 같이 0,403,210 그런 다음 나는 jetty.xml의 변경하려고 : 15.182는 : WARN : oejx.XmlConfiguration : 구성 오류를 java.lang.IllegalStateException에서 :

    <Call name="addAppProvider"> 
        <Arg> 
         <New class="org.eclipse.jetty.deploy.providers.ContextProvider"> 
          <Set name="monitoredDir"><Property name="jetty.home" default="." />/contexts</Set> 
          <Set name="scanInterval">1</Set> 
         </New> 
        </Arg> 
    </Call> 
    
    : ID로 나타내지는 객체 =

    DeploymentManager 그래서 내가 그것을 변경되지 16,

    이것은 java.lang.ClassNotFoundException가 주었다 org.eclipse.jetty.deploy.providers.ContextProvider 상기 링크

    , 그것은 주어진 "이제 코어 인프라 구축의 연장 인 ContextProvider기구 이 기능을 구현합니다. " 그래서 내가 생각하기에 나는이 기능을위한 플러그인을 포함해야한다는 것입니다. 그 다음에 왔어요
    http://wiki.eclipse.org/Jetty/Feature/Jetty_Maven_Plugin#Using_GZip_Compression_and_Other_Jetty_Extensions

    이렇게하면 추가 확장 프로그램을 추가하는 방법에 대한 아이디어를 얻었습니다. 그런 다음 jetty-deploy jar에 ContextProvider가 포함 된 jar를 찾았습니다. <Call name="addAppProvider">에서 구성 에러 : 2012-06-12 13 : 38 : 53.375 : 경고 : oejx.XmlConfiguration

    <plugin> 
        <groupId>org.mortbay.jetty</groupId> 
    <artifactId>jetty-maven-plugin</artifactId> 
    <version>8.1.0.RC5</version> 
    <dependencies> 
        <dependency> 
        <groupId>org.eclipse.jetty</groupId> 
        <artifactId>jetty-deploy</artifactId> 
        <version>8.1.0.RC5</version> 
    </dependency> 
    </dependencies> 
        ... 
    </plugin> 
    

    이 다음 오류 준다 :

    다음의 pom.xml에 다음 구성을 부가 ... No 메소드 : <Call name="addAppProvider"> on org.mortbay.jetty.plugin.

    <Call name="addLifeCycle"> 
        <Arg> 
         <New id="hotdeployer" class="org.eclipse.jetty.deploy.providers.ContextProvider"> 
         <Set name="monitoredDir"><Property name="jetty.home" default="." />/contexts 
          </Set> 
         <Set name="scanInterval">1</Set> 
         </New> 
        </Arg> 
    

    메이븐 : 내가 addLifeCycle 방법 (사용되지 않음)을 발견 그래서 난 (단지 부두 6 컨텍스트 파일에 기록 된 것 같은) 설정 다음과 같은 추가 받는다는 부두 플러그인 항아리에 깊이 파고 JettyServer

    부두 플러그인이 그 후 시작되었습니다. 나는 컨텍스트 내 프로젝트에서 폴더 생성 및 컨텍스트 파일을 추가하고 부두는 다음과 같은 오류가 발생합니다 : org.eclipse.jetty.deploy.providers.ScanningAppProvider.fileAdded (ScanningAppProvider.java 에서

    java.lang.NullPointerException이 을 : (142)) at org.eclipse.jetty.deploy.providers.ScanningAppProvider $ 1.fileAdded (ScanningAppProvider.ja va : 53) at org.eclipse.jetty.util.Scanner.reportAddition (Scanner.java:604) at org. eclipse.jetty.util.Scanner.reportDifferences (Scanner.java:535) (org.eclipse.jetty.util.Scanner.scan) Scanner.java:398

    소스 코드를 보면 행 142는 _deploymentManager.addApp(app);이며 이는 Deployment Manager가 널임을의 L합니다.

답변

1

나는 결국 대답을 발견했다. 당신은 추가해야

<plugin> 

      <groupId>org.mortbay.jetty</groupId> 
      <artifactId>jetty-maven-plugin</artifactId> 
      <version>8.1.0.RC5</version> 

      <dependencies> 
       <dependency> 
        <groupId>org.eclipse.jetty</groupId> 
        <artifactId>jetty-deploy</artifactId> 
        <version>8.1.0.RC5</version> 
       </dependency> 
      </dependencies> 

      <configuration> 
       <webAppConfig> 
        <contextPath>XXXX</contextPath> 
       </webAppConfig> 
       <jettyConfig>jetty.xml</jettyConfig> 
      </configuration> 
    </plugin> 

을 jetty.xml의에서 : pom.xml 파일에 추가해야

<Call name="addBean"> 
    <Arg><New id="DeploymentManager" class="org.eclipse.jetty.deploy.DeploymentManager"><Set name="contexts"><Ref id="Contexts" /></Set><Call name="setContextAttribute"><Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg><Arg>.*/servlet-api-[^/]*\.jar$</Arg></Call></New></Arg></Call> 

<Ref id="DeploymentManager"><Call name="addAppProvider"><Arg><New class="org.eclipse.jetty.deploy.providers.ContextProvider"><Set name="monitoredDirName"><Property name="jetty.home" default="." />/contexts</Set><Set name="scanInterval">1</Set></New></Arg></Call></Ref> 

이 공간의주의, 받는다는 부두 플러그인은 부두의 설정에서 공간에 대한 불만 .xml

+0

전체 jetty.xml 파일을 확인해 주셔서 감사합니다. –