Currently i am trying to deploy a project on an ApplicationServer in Eclipse. Unfortunately all 3rd party libraries are missing. The deployment will end in a ClassNotFoundException (Or the first call).
My Environment:
Eclipse Neon.1a Release (4.6.1) 20161007-1200 for WebDevelopers
Gradle 3.1
Buildship 2.0+
WildFly 10.1.0.Final (and some JBossTools to import the AppServer)
I made a small project to reproduce:
The project consist of 2 parts. An ear part and an ejb part.
test_ear_deployment
|___ear
|___ejb (one bean and a dependency to apache.commons to fail with CNFE)
|___client (do the remote call)
As Server i defined the WildFly 10.1.0 and the ear project as deployment.
The ear part is pretty simple:
dependencies {
deploy project(':ejb')
earlib 'org.apache.commons:commons-lang3:3.5'
}
and the facets. applying ear, java, eclipse-wtp
The ejb part:
dependencies {
compileOnly 'javax:javaee-api:7.0'
compile 'org.apache.commons:commons-lang3:3.5'
}
applying java, eclipse-wtp
The Deployment Assembly of the ejb project does not have the lib in the deploy path.
Neither the ear project does, even if explicitly defined as earlib.
Calling “gradle build” builds the ear containing the third party lib ind the lib directory.
In Eclipse the 3rd party library is alway missing.
Looking at the org.eclipse.wst.common.compoents File, the apache.commons entry is missing. So any deployment on the AppServer withing Eclipse will end up in a ClassNotFoundException. Adding the missing entry by hand will fix the issue:
<dependent-module archiveName="commons-lang3-3.5.jar" deploy-path="/lib" handle="module:/classpath/lib/....lot..../commons-lang3-3.5.jar">
<dependency-type>uses</dependency-type>
</dependent-module>
I saw there where changes in Gradle 3.0 (2.9 is working):
https://docs.gradle.org/3.0/release-notes#eclipse-wtp-handling-of-external-dependencies-changed
The issue is not with BuildShip but with gradle and how the components file is created.
Any project dependency works, any jar dependency does not work.
So i am wondering how to fix this issue? Am i doing something completly wrong?
Thanks in advance for any suggestions.