Notes screwing around with eclipse gradle - tooltwist/documentation GitHub Wiki
Phil, 27th October 2013
There are two (overlapping?) ways of loading gradle build information into Eclipse.
- I'm not sure if this is installed by default.
- If you [right click on the project]->Configure->Convert to Gradle Project it will create a nice Gradle Dependencies entry in the Java Build Path.
- The Deployment Assembly disappears, so you can't configure 3rd party libraries, config and widgets to be installed.
- In the global settings on the Gradle tab, there is the ability to exclude specific jars from deployment (e.g. servlet-api-*.jar).
- Run from the command line in the project directory using
gradle eclipse
. - Use
apply plugin: 'eclipse-wtp'
at the top of build.gradle. - Overwrites some of the config files.
- Includes the jar for j2ee-api, and excludes it from being exported.
Not sure how each of these approaches handles deploying the web and config files. This is probably necessary through Deployment Assembly.
.project
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ttWbd</name>
<comment/>
<projects/>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
</natures>
<buildSpec>
\<buildCommand>
\<name>org.eclipse.wst.common.project.facet.core.builder</name>
\<arguments/>
\</buildCommand>
\<buildCommand>
\<name>org.eclipse.jdt.core.javabuilder</name>
\<arguments/>
\</buildCommand>
\</buildSpec>
\<linkedResources/>
\</projectDescription>
This is for a Java Web Fragment project.
\<?xml version="1.0" encoding="UTF-8"?>
\<faceted-project>
\<runtime name="Apache Tomcat v7.0"/>
\<fixed facet="java"/>
\<fixed facet="wst.jsdt.web"/>
\<fixed facet="jst.webfragment"/>
\<installed facet="java" version="1.7"/>
\<installed facet="jst.webfragment" version="3.0"/>
\<installed facet="wst.jsdt.web" version="1.0"/>
\</faceted-project>
-
Changing config files beneath Eclipse confuses it, doesn't update the little icons on the projects, and may cause it to crash. Restart regularly idf you are experimenting.
-
Maybe try the servlet-api instead of j2ee-api jar file.
-
If you get this error, then one of your projects in including this jar in it's Deployment Assembly. Remove it.
INFO: validateJarFile(/tooltwist/tooltwist_osx_8.0-beta/z1/wtpwebapps/ttsvr2/WEB-INF/lib/javaee-api-6.0.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
-
The menu option in Eclipse [right click on project]->Gradle->Refresh.. (etc) does not display error messages. To see errors run this manually in the project directory:
gradle eclipse
-
If 'Deployment Assembly' goes missing, add this to .project:
http://stackoverflow.com/questions/8399885/eclipse-deployment-assembly-does-not-appear-in-properties<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
Sometimes after making changes the Deployment Assembly screen comes up with an error. Restarting Eclipse should fix that.
-
Beware of the Javascript validator, as it can report huge numbers of errors on 3rd party Javascript libraries like jQuery. Try to avoid the .project entries below. If you have Javascript errors and then remove them, you will be unable to remove the errors from the error log. First, follow the instructions here to exclude all files (**) from Javascript validation.
<buildCommand> <name>org.eclipse.wst.jsdt.core.javascriptValidator</name> </buildCommand> <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
-
Running eclipse plugin:
http://www.gradle.org/docs/current/userguide/userguide_single.html#useEclipsePlugin