2016-11-22 146 views
0

配置:Eclipse的Neon.1。 BuildShip插件1.0.21。 Gradle 3.2。 Tomcat 8.0.33。的Eclipse WTP +搖籃Buildship不部署所有項目的依賴

項目結構:

  • CmbProduct
    • 常見
    • CommonServer
    • 型號
    • CaBridge
    • 的WebApp

我有一個Web服務應用程序項目(「Web應用程序」),這是依賴於多個其他項目。當我使用Eclipse WST/WTP部署,並通過Tomcat中,從 「模式」 只Model.jar運行Web應用程序部署到Tomcat WST運行目錄:

.metadata/.plugins/org.eclipse.wst .server.core/TMP1/wtpwebapp/WEB-INF/lib目錄/ Model.jar

所有其他依賴於休眠等似乎上述被正確部署到同一目錄。

這打破了,當我改變了日食使用Buildship。以前我使用Eclipse STS(Spring)插件,工作正常。

這裏是web項目(Web應用程序)的build.gradle:

apply plugin: 'war' 
apply plugin: 'eclipse-wtp' 

dependencies { 
    compile project(":Common") 
    compile project(":Model") 
    compile project(":CommonServer") 
    compile project(":CaBridge") 
    ... 
} 

eclipse { 
    wtp { 
     component { 
      // Configure the <Context path="..."/> in server.xml 
      contextPath = '/console' 

      // dependencies to mark as deployable with lib folder deploy path 
      libConfigurations += [ project(":MagniCompCommon").configurations.runtime ] 
     } 
    } 
} 

在上述例子中我第一次嘗試沒有eclipse.wtp.libConfigurations部。我試圖補充說,解決這個問題,但它沒有效果。是的,我確實運行了'gradle eclipseWtp',然後在做出更改後從其服務器條目中添加/刪除'WebApp'應用程序。

如果我去到Eclipse - > Web應用程序 - >屬性 - > Java構建路徑 - >庫,並期待在「Web應用程序庫」之我見「型號」,而不是其他項目。如果我看「項目和外部依賴項」,我會看到列出的所有項目。

這裏是模型(工作)中的build.gradle:

apply plugin: 'eclipse-wtp' 

dependencies { 
    compile project(":MagniCompCommon") 
} 

這裏的build.gradle爲通用(未部署):

apply plugin: 'eclipse-wtp' 

dependencies { 
    //compile project(":MagniCompCommon") 
    compile project(":Model") 

    compile("org.glassfish.jersey.containers:jersey-container-servlet:$jerseyGlassfishVersion") 
    // Required for JAX-RS Client 
    compile("org.glassfish.jersey.core:jersey-client:$jerseyGlassfishVersion") 
} 

這裏是頂級的build.gradle級項目(CmbProject):

apply plugin: 'java' 

subprojects { 

    apply plugin: 'java' 
    apply plugin: 'nebula.provided-base' 
    apply plugin: 'nebula.optional-base' 

    sourceCompatibility = JavaVersion.VERSION_1_8 
    javadoc.enabled = false 

    sourceSets { 
     main { 
      java { 
       // Define all source dirs - Purpose is to add "src-gen" 
       srcDirs = ["src/main/java", "src-gen"] 
      } 
     } 
    } 

    /* 
    * Repositories used by each subproject must be given below. 
    * Because each subproject resolves dependencies of other 
    * subprojects, all subprojects must know all repos. 
    * In other words, if projectA needs repo "foo.org" and projectB 
    * depends upon projectA, then projectB needs repo "foo.org" as 
    * well. 
    */ 
    repositories { 
     maven { 
      // Local repo for annovention 
      url uri("$rootDir/MagniCompCommon/repo") 
     } 

     mavenCentral() 
     maven { 
      url "http://download.java.net/maven/2" 
     } 
     maven { 
      // Texo/EMF 
      url "https://oss.sonatype.org/content/groups/public/org/eclipse/emf" 
     } 
     maven { 
      // Eclipse 
      url "https://oss.sonatype.org/content/repositories/public/eclipse" 
     } 
     maven { 
      url "https://repository.jboss.org/nexus/content/groups/public-jboss" 
     } 
     maven { 
      url "http://maven.vaadin.com/vaadin-addons" 
     } 
     maven { 
      url "http://oss.sonatype.org/content/repositories/vaadin-snapshots" 
     } 
     maven { 
      url("http://maven.clapper.org") 
     } 
     /* 
     * -ADD LAST- so that it doesn' override any others 
     * DynamicReports depends upon JasperReports which lists their own 
     * bug fixed versions of packages like "com.lowagie:itext:2.1.7.js2" 
     * This repo provides such patched packages. 
     */ 
     maven { 
      url("http://jasperreports.sourceforge.net/maven2") 
     } 
    } 

    /* 
    * Variables local to this file 
    */ 
    def bouncycastleVersion = "1.54" // Was 1.51 
    def slf4jVersion = "1.7.19" 
    def hibernateVersion = "4.3.11.Final" 
    def texoVersion = "0.9.0-v201501182340" 
    def emfVersion = "2.11.0-v20150123-0347" 
    def jnaVersion = "4.1.0" 

    ext { 
     /* 
     * Variables here are used by subprojects 
     */ 
     vaadinVersion = "7.6.8" // was 7.6.4 
     vaadinIconsVersion = "1.0.1" 
     jerseyGlassfishVersion = "2.23.2" // was 2.22.2 
    } 

    dependencies { 

     /* 
     * PRODUCT SPECIFIC 
     */ 
     compile("org.bouncycastle:bcprov-jdk15on:$bouncycastleVersion") 
     compile("org.bouncycastle:bcprov-ext-jdk15on:$bouncycastleVersion") 
     compile("org.bouncycastle:bcpkix-jdk15on:$bouncycastleVersion") 

     compile("com.h2database:h2:1.3.176") 

     testCompile("org.testng:testng:6.9.4") 

     /* 
     * MagniComp common and product 
     */ 
     compile("org.simpleframework:simple-xml:2.6.9") 
     // Logging slf4j API 
     compile("org.slf4j:slf4j-api:$slf4jVersion") 
     // Send JCL to slf4j 
     compile("org.slf4j:jcl-over-slf4j:$slf4jVersion") 
     // Anything using JUL should defer to slf4j 
     compile("org.slf4j:jul-to-slf4j:$slf4jVersion") 
     // Send slf4j to log4j 1.2 for those JARs which use slf4j 
     compile("org.slf4j:slf4j-log4j12:$slf4jVersion") 
     // Log4j itself 
     compile("log4j:log4j:1.2.17") 
     // Hibernate 
     // Do not include "hibernate-core" explicitly as hibernate-entitymanager will take care of it 
     compile("org.hibernate:hibernate-entitymanager:$hibernateVersion") 
     compile("org.hibernate:hibernate-c3p0:$hibernateVersion") 

     compile("mysql:mysql-connector-java:5.1.38") 

     // Texo 
     compile("org.eclipse.emf:org.eclipse.emf.texo:$texoVersion") 
     compile("org.eclipse.emf:org.eclipse.emf.texo.server:$texoVersion") 
     compile("org.eclipse.emf:org.eclipse.emf.texo.xml:$texoVersion") 
     // Texo dependencies (not automaticly added by texo) 
     compile("org.eclipse.emf:org.eclipse.emf.common:$emfVersion") 
     compile("org.eclipse.emf:org.eclipse.emf.ecore:$emfVersion") 
     compile("org.eclipse.emf:org.eclipse.emf.ecore.xmi:$emfVersion") 
     // Required by org.eclipse.emf 
     // Disable because it's causing: 
     // java.lang.SecurityException: class "org.osgi.framework.BundleReference"'s signer information does not match signer information of other classes in the same package 
     //compile("org.eclipse.core:org.eclipse.core.runtime:3.7.0") 

     compile("org.jsoup:jsoup:1.7.2") 

     // Apache HTTP client 
     compile("org.apache.httpcomponents:httpclient:4.3.5") 
     // EventBus and more 
     compile("com.google.guava:guava:18.0") 

     // Quartz scheduler 
     compile("org.quartz-scheduler:quartz:2.2.2") { 
      exclude group: "c3p0", module: "c3p0" 
     } 
     // Java Mail 
     compile("javax.mail:mail:1.4.5") 

     // JNA for Common and CaBridge 
     compile("net.java.dev.jna:jna:$jnaVersion") 
     compile("net.java.dev.jna:jna-platform:$jnaVersion") 

     // This package provided by Tomcat or Servlet container 
     provided("javax.servlet:javax.servlet-api:3.1.0") 

    } 
} 

回答

0

由於從gradle這個論壇上,我找到了解決辦法提供一些幫助。

每個項目,這是一個WTP項目每個都必須有一個相關性:

apply plugin: 'eclipse-wtp' 

只有在WTP項目有此是不夠的。