Invalid publish / export dependency / ouat -contract. Project records are not supported

I am trying to create a multi-page Gradle project similar to this structure

ouat-services
  - ouat-contract
  - ouat-servicesImpl (web project)

      

I followed eclipse example and defined my ouat-services.gradle settings as

include "ouat-contract", "ouat-servicesImpl"

      

In my project ouat-servicesImpl-gradle I define

dependencies {
  compile project(':ouat-contract')
}

      

My problem starts when I try to apply the military plug-in in ouat-servicesImpl, I get the following message in the eclipse issue view:

Invalid classpath publish/ export dependency /ouat-contract. Project entries not supported

      

My ouat-services build.gradle

configure(subprojects) {

  apply plugin: 'com.github.ben-manes.versions'
  apply plugin: 'eclipse'
  apply plugin: 'java'

  version = '1.0'

  sourceCompatibility = 1.8
  targetCompatibility = 1.8

  def defaultEncoding = 'UTF-8'
  [compileJava, compileTestJava]*.options*.encoding = defaultEncoding

  repositories {

    jcenter()
    mavenLocal()
    mavenCentral()
  }

  jar {
    manifest.attributes provider: 'Company'
  }
}

configure(project(':ouat-servicesImpl')) {

  apply plugin: 'checkstyle'
  apply plugin: 'eclipse-wtp'
  apply plugin: 'findbugs'
  apply plugin: 'jacoco'
  //apply plugin: 'jetty'
  apply plugin: 'pmd'
  apply plugin: 'war'
}

buildscript {

  repositories {

    jcenter()
    mavenCentral()
    mavenLocal()
  }

  dependencies {
    classpath 'com.github.ben-manes:gradle-versions-plugin:0.10.1'
  }
}

      

My ouat-servicesImpl build Gradle has been changed to:

dependencies {

  compile project(':ouat-contract')

  cxfArtifacts.each { artifact ->
    compile "org.apache.cxf:$artifact:$cxfVersion"
  }

  springArtifacts.each { artifact ->
    compile "org.springframework:$artifact:$springVersion"
  }

  testCompile "org.testng:testng:$testNGVersion"
  testCompile "org.hamcrest:hamcrest-all:$hamcrestVersion"
  testCompile "org.springframework:spring-test:$springVersion"

  //WAR PLUGIN
  providedCompile "javax.servlet:javax.servlet-api:$servletAPIVersion"
  runtime "javax.servlet:jstl:$jstlVersion"
}

      

Is this a problem with the eclipse plug-in or am I doing something wrong?

+3


source to share


3 answers


I faced this problem for a long time too. This is actually a problem with the Eclipse plugin included in the "Gradle IDE Pack" (since this works from the command line without issue). My setup is probably a lot more complicated than yours (I am including modules from one top level gradle project to another top level gradle project), but to overcome this particular error

Invalid classpath publish/ export dependency /my-project. Project entries not supported

      

... I excluded the project dependency if there was no gradle specific property:



if(project.hasProperty("myProjectRefAddedFromIDE")) {
    println "NB! Build script started with property 'myProjectRefAddedFromIDE' - expecting that this project in IDE is configured to add the direct reference to my-project"
} else {
    compile project(':my-project')
}

      

And to add property "myProjectRefAddedFromIDE" from IDE only, I configured eclipse plugin like this: Window -> Preferences -> gradle -> Arguments -> Programmatic Arguments -> Usage: '-PmyProjectRefAddedFromIDE'

Just a warning: this will probably work for you, but there could be another problem with your setup, as for a simple multi-module project (which doesn't include modules from another multi-module project), I shouldn't use this workaround.

0


source


Here are the magical steps I found to get them working without having to mess with manual project settings.



  • Run command: gradle cleanEclipse eclipse

    • as a result of this command, Eclipse forgets that the project must be gradle.
  • Add the gradle character back to the project by doing Configure -> Convert to gradle Project.

    • this command returns the error.
    • If there is an incompatible java plugin version error, just delete the .restings directory and update.
  • Run command: gradle cleanEclipseClasspath eclipseClasspath

    • this last step should be corrected before next time.
+11


source


In my case, this was due to a mixture of "faceted" and limitless projects. The projects with the error were converted to faceted form and the project they referenced that he complained about was not. You can configure the project to be eclipse-wtp

faceted using the plugin by adding it to your ouat-contract gradle file:

eclipse{
    wtp{
        facet{}
    }
}

      

This will add faces for Java and service module when using java and war plugins (see EclipseWTPFacet documentation for more information on default and manually adding faces if you are not using war plugin). The service module part is the key to avoid the error.

Note that in this block, you can also directly access the facet file to do manual XML manipulation if you need to do other things, such as specifying a specific temporary Apache Tomcat environment or similar

Once you make this change, you can use Eclipse to do gradle -> Refresh All on ouat-contract in your workspace - once I did that, the error went away

+3


source