I try to setup a Java EE environment to be built with gradle. In the end I want to have an EAR file containing an EJB-Jar and some kind of application client that can be deployed to Glassfish (probably). The setup will be quite basic.
Currently I am facing two problems:
1) Running the 'ear' task to assemble the EAR archive creates a faulty application.xml file in tmp/ear that looks like this:
<?xml version="1.0"?>
<application xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="6">
<display-name>DataViewerEAR</display-name>
<library-directory>lib</library-directory>
</application>
The error message eclipse reports is:
cvc-complex-type.2.4.a: Invalid content was found starting with element 'library-directory'. One of '{"http://java.sun.com/xml/ns/javaee":display-name, "http://java.sun.com/xml/ns/javaee":icon, "http://java.sun.com/xml/ns/javaee":initialize-in-order, "http://java.sun.com/xml/ns/javaee":module}' is expected.
The deployment descriptor file I created with the help of eclipse in earContent/META-INF seems to be ignored:
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/application_7.xsd" version="7">
<display-name>DataViewerEAR</display-name>
<module>
<ejb>DataViewerEJB.jar</ejb>
</module>
<module>
<java>DataViewerTestClient.jar</java>
</module>
</application>
The content of the asssembled EAR file looks ok.
2) The resulting jar of the EJB build is empty. I think the main problem is that the EJB project's structure does not match the assumed src/main/java etc. and I don't know how to change this. My current build.gradle file for the EJB project looks like this:
apply plugin: 'java'
repositories {
jcenter()
}
dependencies {
compile 'ch.qos.logback:logback-classic:1.1.5'
testCompile 'junit:junit:4.12'
}
It would also be great If someone could tell me what things you have to pay attention to when configuring the application. Deployment descriptors and other .xml files. Not to forget anything...