Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging project generated by Gradle on Eclipse

I have an issue - the command "gradle eclipse" generates the necessary Eclipse WTP files. I can import the project into Eclipse, but when I deploy to Glassfish it does not copy anything to Glassfish's eclipseApp directory.

I verified that the project is a Dynamic Web Facet but it still doesn't work.

Any help would be greatly appreciated.

Thanks

like image 433
Chir Avatar asked Dec 11 '10 16:12

Chir


People also ask

How do I debug a Gradle project in Eclipse?

Open Eclipse and go to Run -> Debug Configurations.... Select the Remote Java Application in the list of configuration types on the left. Click the New toolbar button. In the Project field of the Connect tab, type or browse to select the project to use as a reference for the launch (for source lookup).

How do I debug a project in Eclipse?

A Java program can be debugged simply by right clicking on the Java editor class file from Package explorer. Select Debug As → Java Application or use the shortcut Alt + Shift + D, J instead. Either actions mentioned above creates a new Debug Launch Configuration and uses it to start the Java application.


2 Answers

Yes this is a very common issue. Typically, when you use one builder to generate project files for you, or even a custom plug-in to detect change events, rebuild your app with a custom script and hot-deploy it to your app server.

The Dynamic Web Facet is one thing, but when gradle generates your project file, it does not know what app server you will be using. Go into Project Properties -> Facets -> Dynamic Web -> Runtimes and then configure your GF instance or link it.

You might have already done it but that's my 2 cents about what's wrong.

like image 85
Gepsens Avatar answered Sep 24 '22 03:09

Gepsens


Obviously you are using eclipse plugin to do so. Here is what you can do further to ensure gradle cleanEclipse and gradle eclipse continue to play nice with your project.

Watch what natures and build Commands are required in your .project file. Once you are aware of them all, the next thing to do is configure the eclipse task like so

apply plugin: 'eclipse'
eclipse {
    project {
        name = 'eclipse-appname'

        natures << 'org.eclipse.jdt.groovy.core.groovyNature'
        buildCommand 'org.eclipse.....Validator'
        buildCommand 'org.eclipse.jdt.core.javabuilder'
    }
}

I have added natures and build commands randomly, replace with the appropriate ones that you see in your .project.

like image 45
skipy Avatar answered Sep 22 '22 03:09

skipy