Compile Groovy files in Eclipse - eclipse

My java web project includes some Groovy code. But eclipse is not recognizing Groovy files and not generating any classes out of it.
I have installed Groovy plugin in Eclipse. Installed Groovy in my windows machine and setup GROOVY_HOME and include groovyall jar file in my lib folder. But no luck.
Please help.

Have you converted your project into a groovy project? In order for groovy files to be compiled, they must be in a groovy project. Select Project, right-click -> Configure -> Convert to Groovy Project...
This will set up the groovy dependencies correctly. You can remove the groovy-all jar from your lib folder.

You could also use STS, when the dashboard opens up click on the "extensions" tab and click on the Groovy language feature and install it. Then right click on project, -> Spring -> configure groovy nature to use groovy also.
Another option is create a new Groovy project, the upshot is that you can use any java file within a groovy project since they are so well coupled.

Related

Develop jenkins groovy script in Eclipse

Is it possible to develop a groovy script (pipeline) for Jenkins in Eclipse?
I want to connect to a running Jenkins instance and create / start some jobs. How can i achieve this?
Jenkins does not have strong IDE support in any IDE. However, Eclipse (as well as most major java IDE's) does have a groovy plugin and you can import the core jenkins jars to get some auto-completion. At the very least, the IDE gives you autoformatting, with is of some help. Once you've developed your script, you will have to copy it out to jenkins to test.
To work with Jenkins Pipeline, I have setup Eclipse like this:
Download and extract Jenkins.war Distribution (it's just a zip file with *.war file extension) from jenkins.io, currently version 2.361.1 LTS.
Run the jenkins war file.
2.1. Open a terminal and run java -jar jenkins.war.You will see that Jenkins will ask for the initial configuration and it will provide an initial password.
2.2. Copy the initial password showed in the terminal.
2.3 Open http://localhost:8080 in a WebBrowser and paste the initial password you have copied from the terminal.
2.4. Follow the steps to install the default plugins. All of these files will be saved in $HOME/.jenkins folder.
Install Eclipse Java IDE Version 2022-03 (4.23.0), I chose flavor: "Eclipse IDE for Java Developers"
Install Eclipse Groovy Plugin 4.5.0 (via Help->Marketplace search for groovy)
Create an Eclipse User Library via Window -> Preferences:
Then go to Java -> Build Path -> User Libraries, add new User Library with name "Jenkins Pipeline". Then add the following "External Jars..." to this library.
Uncompress jenkins.war (tar xvf jenkins.war) file and add the following files:
5.1. jenkins/WEB-INF/lib/*.jar
Add these libraries from the plugins directory of jenkins home:
5.2. ~/.jenkins/plugins/workflow-cps-global-lib/WEB-INF/lib/*.jar
If you cannot find this directory it means you are running a new version of Jenkins. In this case, you should use:
~/.jenkins/plugins/pipeline-groovy-lib/WEB-INF/lib/*.jar
5.3. ~/.jenkins/plugins/workflow-cps/WEB-INF/lib/*.jar
5.4. I also add junit to the library because it is often used:
~/.jenkins/plugins/junit/WEB-INF/lib/*.jar
Create your groovy pipeline project:
File -> New -> Project... -> Groovy -> Groovy Project.
Then add the User Library "Jenkins Pipeline" to the Build Path:
Right click the groovy project -> Build Path -> Add Libraries -> User Library
Finally add more libraries from the plugins folder to your project according to your needs

how can I create maven Gwt project?

Hello friends I have not so much Idea about maven build tool. I just download and install it in my system as I read maven is a build tool and work perfectly with transitive dependency. this is the basic reason to use it
I also configure mavan plugin in Eclipse.
so what is the proper Gwt maven archetype in eclipse and I read so many command in tutorials like maven:gwt run but I dont to where is this command exist in eclipse
I am very new in maven so please help me like a beginner
This is a common approach to get support of maven in existing GWT-Project
Make a gwt project by using the gwt plugin in Eclipse. Now you have
an Eclipse gwt project.
Select the project in Project Explorer , right-click it, then choose
Configure . Then select Convert to Maven Project . Now you get a
gwt-maven project.
Now add necessary dependencies to pom.xml .
if you want to create a gwt maven project directly you need to choose gwt archetype if not exist you can add this have a look in
this video
You should:
Download the gwt plugin in Eclipse and create a gwt project.
In Eclipse select the project, right-click on it, then choose Configure. Then select Convert to Maven Project.
Now you get a gwt-maven project.

Importing Apache Lucene-Solr into Eclipse Luna

I'm having a great deal of difficulty importing the source from git://git.apache.org/lucene-solr.git into Eclipse. I mean, I can import it as a vanilla non-java project, but that's not very helpful. It's not a Maven project, but it has this Ivy thing. I've download the IvyDE plugin, but I don't understand how to use it to import a project, and I haven't found any useful documentation from the Lucene project relevant to my problem.
Any ideas?
Edit:
To be clear, I'm not trying to add Lucene to any application. I simply want to browse the source code in Eclipse as a stand-alone project.
I did just
ant compile
ant eclipse
and then in Eclipse
File -> Import -> Existing Projects Into workspace
and that's it.
you can find the needed steps here [1]. As you said, it's not a maven project so there are some preliminary (ant) steps to do before.
[1] https://wiki.apache.org/solr/HowToContribute#Getting_the_source_code
Although Lucene is not --- at first --- a maven project, you can create a Maven project with a provided Ant target (I guess it is a target but I haven't checked the code).
In the sub-directory dev-tools/maven/README.maven there are instructions on how to make Lucene a Maven project:
ant get-maven-poms
cd maven-build
Now you can use all the normal Maven commands and import the Maven project into Eclipse (although it won't show the source).
If you wish to edit the source use:
ant compile
ant eclipse
Happy coding!
Ref.:
http://svn.apache.org/repos/asf/lucene/dev/branches/lucene_solr_4_0/dev-tools/maven/README.maven
http://svn.apache.org/repos/asf/lucene/dev/branches/lucene_solr_4_0/README.txt

Plug-in for Eclipse

I am developing a plug-in for eclipse for JSHOP2 language. For that i made a plug-in project with 'editor'. I have written the code for the neceessary syntax highlighting for JSHOP2 but I don't know how to integrate this types of plug-in with eclipse and then how to take use of it, so that while i write the JSHOP2 code the necessary syntax gets highlighted. Please help me with this.
So you have an editor that works correctly?
Then you need to make sure the files with your extension are opened with your editor. That is described in the Eclipse wiki.
To make sure your plugin is integrated to your version of Eclipse, either create an update site and import the plugin as you would do with any other plugin. Or export the plugin to a jar and copy the jar to the dropins catalog.
Since you are using eclipse to write java code (plug-in project). Create a new eclipse launch configuration. Menu Run -> Run Configuration. Location eclipse application. Right click -> Create new & Run. Hope this helps.

Using both netbeans and eclipse to edit a netbeans project

Hi Netbeans is the default IDE at my workplace. I want to use Eclipse to edit the Netbeans projects. How easy or difficult is it to do this. Can someone outline the steps involved for this.
You should be able to import an existing project into Eclipse by:
File -> Import -> Choose General -> Existing Projects into Workspace
It won't pick up your Netbeans settings however. You may need to set your project up manually in terms of a libraries, source location etc..
Alternatively, if you're using Maven and Eclipse m2eclipse you should be able to import a Maven project and have it pick up most of the settings.
Importing an eclipse project should be easy (for Netbeans 6.7): File->Import Project->Eclipse Project
Or create a 'project with existing sources' which is available for Java, ruby, ...