Tag Archives: Setup

Some tips on TomEE development environment setup

I was recently interested to take a look what’s inside the TomEE app server.

We’re using it “heavily” in production. I was interested how some stuff was done.

The great stuff what it’s just a usual maven project. Actually all the info can be found here – http://tomee.apache.org/dev/source-code.html but step by step instruction may be of a help.

So I’ve started from getting the source with executing
git clone https://git-wip-us.apache.org/repos/asf/tomee.git tomee

Before importing the project into IDE a very good idea is to make a full build by calling

mvn -Dsurefire.useFile=false -DdisableXmlReport=true -DuniqueVersion=false -ff -Dassemble -DskipTests -DfailIfNoTests=false clean install

It will take a while, it will download all the dependencies and build TomEE without executing all the tests. Something that pleased me a lot is there is no need for any other special setup.

The integration with IDE is also quite seamless.

In IntelliJ Idea for example Just import the project from POM:

1

Then check ALL:

2

and in about 30 min you will get fully indexed working environment:

3

For Eclipse its almost the same. First import existing maven project into workspace:

14 марта 2016 г. 09-36-52

Eclipse finally supports hierarchical maven projects:

14 марта 2016 г. 09-38-04

And we are done!

11

A good idea may be to select hierarchical project representation of the project 🙂

The TomEE team has done a great job to make the development setup extremely simple! Within just few action you can start developing for TomEE.

KUDOS to the team!

 

Nashorn Eclipse Development Environment Setup

Yo fellows!

I recently had some time, so I’ve played with Eclipse to set it up for Nashorn. This article is adopted from the previous one regarding Intllij Idea.

The current setup is made on OS X Yosemite and the latest Eclipse (Luna). But the setup for other OSs should run almost the same way.

1. Verify you have JDK8 installed.

2. Using mercurial clone the repository http://hg.openjdk.java.net/jdk9/dev to the folder you want and execute get_sources.sh

3. Now switch to Eclipse and create a project called Nashorn directly in the folder “<JDK9_SOURCES>/nashorn”

17 июня 2015 г., 11:09:56

4. Eclipse is quite clever to find source folders:

17 июня 2015 г., 11:35:25

 

5. A bit tricky part: The compilation, development and debugging currently is done against JDK8 since the IDE still does not support JDK9 and the jimage distribution mechanism. So, in order JDK’s Nashorn not to interfere with one we build it’s a good idea to make a new copy of JDK8 and to remove the nashorn.jar from the JDK located under <JDK8_ROOT>/jre/lib/ext/nashorn.jar:

1

 

 

6. Now add this JDK to the IDE:

17 июня 2015 г., 11:39:25

7.  Almost done. Another tricky part: In Nashorn the so called “JavaScript” classes are been generated. There is a special tool “nasgen” for that and it is locates in the “buildtools/nasgen” directory.

17 июня 2015 г., 11:52:04

 

8. Before running the Nashorn itself the nasgen “all” ant target should be run.

9. Add the resulting “nasgen.jar” to the “Build Path” if it’s not there already.

17 июня 2015 г., 11:54:16

10. Navigate to “<nashorn>/make” folder and run the “all” ant target.

11. Add the resulting classed in “<nashorn>/build/classes/” to the “Build Path”:

17 июня 2015 г., 11:59:31

 

12. Now it is possible to run the Shell.java to explore and debug the code:

17 июня 2015 г., 12:02:24

 

Debugging is available directly in the IDE :

17 июня 2015 г., 12:09:38

 

Warning: Have in mind that some of classes – so called “JavaScript” classes are been generated. Their “bootstrapping” classes are annotated with @ScriptObject. Take some time to explore them. They cannot be debugged from that perspective. But “System.out.println” might help :)

Have fun developing the Nashorn!

Nashorn IntelliJ Idea development environment setup

Yo fellows!

As a part of the Bulgarian JUG I’m interested in contribution to the Nashorn Project!

In this post I’ll try describe how to setup the IntelliJ based development environment for Nashorn.

The current setup is made on OS X Yosemite and IntelliJ Idea version 14. But the setup for other OSs should run almost the same way.

1. Verify you have JDK8 installed.

2. Using mercurial clone the repository http://hg.openjdk.java.net/jdk9/dev to the folder you want and execute get_sources.sh

3. Create an empty Java project somewhere in your system but NOT in the folder where the pulled JDK9 sources are.

4. Make a project module with root “<JDK9_SOURCES>/nashorn”, and assign sources to” src/jdk/scripting/nashorn/share/classes”

1

5. A bit tricky part: The compilation, development and debugging currently is done against JDK8 since the IDE Idea 14 does not support JDK9 and the jimage distribution mechanism. So, in order JDK’s Nashorn not to interfere with one we build it’s a good idea to make a new copy of JDK8 and to remove the nashorn.jar from the JDK located under <JDK8_ROOT>/jre/lib/ext/nashorn.jar:

1

6. Now add this JDK to the IDE:

1

 

7.  Almost done. Another tricky part: In Nashorn the so called “JavaScript” classes are been generated. There is a special tool “nasgen” for that and it is locates in the “buildtools/nasgen” directory.

1

 

8. Before running the Nashorn itself the nasgen “all” ant target should be run.

9. Add the resulting “nasgen.jar” to the module dependencies.

10. Navigate to “<nashorn>/make” folder and run the “all” ant target.

11. Add the resulting classed in “<nashorn>/build/classes/” to the module dependencies:

1

12. Now it is possible to run the Shell.java to explore and debug the code:

1

 

Debugging is available directly in the IDE :

1

 

Warning: Have in mind that some of classes – so called “JavaScript” classes are been generated. Their “bootstrapping” classes are annotated with @ScriptObject. Take some time to explore them. They cannot be debugged from that perspective. But “sout” might help 🙂

 

Have fun developing the Nashorn!