Reputation: 2843
I just gave IntelliJ a try, because Eclipse annoyed me again. I imported my gradle project(jetty, vaadin) and it went quite smoothly. But when I tried to run it I encountered the following error message during "make":
Error:gradle-resources-test:vaadinsharedwidgets: java.lang.NoClassDefFoundError: org/apache/tools/ant/util/ReaderInputStream
"vaadinsharedwidgets" is a module of the project. From what I understand from the error, IntelliJ doesn't find ant, but this is intended because I don't use ant. It also not part of the transitive dependencies. The same project runs in eclipse fine and also building it in gradle works without any problems.
Update: I just checked in Eclipse and somehow the ant.jar is on the classpath in Eclipse but I can't link it to any project. I wonder how it got there.
Update2: Missing version information:
build.gradle
:
apply from: 'http://nexus/gradle/vaadin.gradle'
apply from: 'http://nexus/gradle/java8.gradle'
version = '1.1'
description = "Gemeinsame Vaadin-Widgets"
vaadin.widgetset 'net.xyz.vaadinsharedwidgets.VaadinsharedWidgetsWidgetset'
dependencies {
compile project(':ibhtheme')
compile 'com.vaadin:vaadin-server:' + vaadin.version
compile 'com.vaadin:vaadin-client:' + vaadin.version
}
jar{
// Include source in jar
from sourceSets.main.allJava
}
sourceSets.main.resources.srcDir 'src/main/webapp'
vaadin.gradle:
apply from: 'http://plugins.jasoft.fi/vaadin.plugin?version=0.9.2'
configurations {
def conf = 'vaadin-client'
def sources = project.sourceSets.main
def testSources = project.sourceSets.test
if (!project.configurations.hasProperty(conf)) {
project.configurations.create(conf)
sources.compileClasspath += project.configurations[conf]
testSources.compileClasspath += project.configurations[conf]
testSources.runtimeClasspath += project.configurations[conf]
project.configurations[conf].exclude group: 'org.eclipse.jetty'
}
}
vaadin {
version '7.3.4'
push true
}
java8.gradle:
apply plugin: 'java'
sourceCompatibility = 1.8
targetCompatibility = 1.8
group = 'net.xyz'
dependencies {
compile 'org.slf4j:slf4j-api:1.7.5'
compile 'com.google.guava:guava:16.0.1'
compile 'org.springframework:spring-context:4.0.3.RELEASE'
testCompile 'org.testng:testng:6.8.7'
testCompile 'org.mockito:mockito-all:1.9.5'
testCompile 'org.easytesting:fest-assert-core:2.0M10'
testCompile 'org.springframework:spring-test:4.0.3.RELEASE'
}
Adding ant as an additional dependency to the module doesn't work.
Upvotes: 15
Views: 17230
Reputation: 16575
Choose File → Invalidate Caches / Restart
from the menu and select Invalidate and Restart
. That fixed the issue for me.
Upvotes: 3
Reputation: 34343
I encountered the same error in a Java project with multiple subprojects in IntelliJ 14.
Updating to 15.0.1, refreshing the Gradle projects via Views → Tool Windows → Gradle
in IntelliJ and restarting fixed the issue.
Upvotes: 10
Reputation: 2843
After some tinkering and try-and-error I found that the following code in the vaadin.gradle was the culprit and removed it:
configurations {
def conf = 'vaadin-client'
def sources = project.sourceSets.main
def testSources = project.sourceSets.test
if (!project.configurations.hasProperty(conf)) {
project.configurations.create(conf)
sources.compileClasspath += project.configurations[conf]
testSources.compileClasspath += project.configurations[conf]
testSources.runtimeClasspath += project.configurations[conf]
project.configurations[conf].exclude group: 'org.eclipse.jetty'
}
}
It was part of an outdated hack to use jetty9 instead of jetty8, which was used by older versions of the vaadin-gradle plugin. The current version uses 9.2.2 which seems to be fine.
Upvotes: 2