persistence@glassfish.java.net

Re: Compiling Glassfish in Eclipse

From: Tom Ware <tom.ware_at_oracle.com>
Date: Thu, 17 Aug 2006 12:05:41 -0400

Hi Markus,

  I am admittedly not an Eclipse power user, but here is what I do to
get my entity-persistence projects to build in Eclipse.

- My Eclipse project contains a copy of the files checked out from CVS.
(The files from <cvs workspace>/glassfish/entity-persistence/src/java)
- I depend on two things to compile this project
  1. A glassfish javaee.jar file. I obtain this by using the "maven
bootstrap" functionality to get it, but one could just as easily be
obtained by downloading the latest nightly build and installing it. It
is found in <glassfish install directory>/lib.
  2. A couple of source files generated by antlr during the build
process. You can either have a look at the antlr.generate target in the
build.xml found in entity-persistence for information about how to
generate or just used the files from the attached jar: EJBQLAntlr.jar.
- With these two dependancies added, my entity-persistence project will
compile.
- Using the classes within Glassfish is a matter of updating the
toplink.essentials.jar file in <glassfish install directory>/lib with
the newly compiled classes. I usually use the build script to do this,
but a jar could be fairly easily created since all it contains are the
compiled class files and 4 other files.
  * The META-INF directory and its contents from
entity-persistence/resources
  * The VendorNameToPlatformMapping.properties file found in
src/java/oracle/toplink/essentials/internal/helper (This file should be
place in the oracle/toplink/essentials/internal/helper directory of the
jar file)
  * The two xsd files found in: <cvs
workspace>/glassfish/persistence-api/schemas
- If you want to see a built version of this file, you can either get it
in you glassfish install or get the latest build from the following
webpage:
https://glassfish.dev.java.net/downloads/persistence/JavaPersistence.html

- My entity-persistence-tests project depends on 3 things
  1. The set of compiled files from the entity-persistence project
described above
  2. The javaee.jar file mentioned above
  3. A JUnit jar file - I use the one found in <cvs
workspace>/glassfish/appserv-tests/lib
- With those files it compiles
- The tests are actually run using 3 jar files. The way they are build
is best described in the build.xml found in entity-persistence-tests,
but if you would like some additional information about their contents,
just let me know.

If you can get these projects to compile, the next step is to run the
tests. I can help you with the entity-persistence-tests. We will have
to include the folks from Sun in the discussion about how to get the app
server tests to run.

Let me know if this information is helpful and where you would like
further details,
Tom


Markus KARG wrote:

>I found some more time to play with out-dated Maven 1.0.2 and got
>Eclipse to at least edit and compile entity-persistence module. Here is
>what I had to do to make it work:
>- In Eclipse, use CVS browser to download the complete (!) glassfish
>source (not only the persistency module). BEWARE NOT TO NAME THE Eclipse
>Project "Glassfish", but it must be named "glassfish" (all in lower
>cases -- Maven will fail otherwise).
>- Install out-dated Maven 1.0.2 (yes, even if you have current Maven
>2.0.4 installed already...)
>- Close Eclipse
>- Move the glassfish folder from your Eclipse workspace to somewhere
>else, e. g. /home/yours
>- Go to the command line (e. g. bash)
>- Go into the glassfish/glassfish folder
>- Set your correct JAVA_HOME (mine was softlinked to GNU Classpath,
>which will fail due to a Maven 1.0.2 bug; you need Sun JDK).
>- Set your PATH to include the maven-1.0.2/bin folder.
>- Type: maven
>- Should run without a failure (but needs hours)
>- Go into the glassfish/entity-persistence folder
>- Type: maven (Maven 2.0.4 users: Do NOT type mvn compile)
>- Should run without a failure, but needs some minutes
>- Type: maven -Dmaven.eclipse.workspace=/home/yours/.eclipse
>eclipse:add-maven-repo (.eclipse is the folder I am hosting my eclipse
>workspace inside). (Maven 2.0.4 users: Do NOT type mvn
>-Declipse.workspace, but really maven -Dmaven.eclipse.workspace).
>- Should run without a failure. BEWARE NOT TO HAVE ECLIPSE OPEN WHILE
>THIS IS RUNNING.
>- Type: maven eclipse (Maven 2.0.4 users: Do NOT type mvn
>eclipse:eclipse but really maven eclipse).
>- Open Eclipse
>- File/Import: Import existing project into current workspace; select:
>/home/yours/glassfish/entity-persistence/
>- After some seconds Eclipse should show the project, without any error
>message.
>
>This procedure allows me to edit & compile entity-persistence in Eclipse
>3.1, but it doesn't work for entity-persistence-test due to the
>following failure:
>
>markus_at_localhost:~/glassfish/entity-persistence-tests> maven
> __ __
>| \/ |__ _Apache__ ___
>| |\/| / _` \ V / -_) ' \ ~ intelligent projects ~
>|_| |_\__,_|\_/\___|_||_| v. 1.0.2
>
>The build cannot continue because of the following unsatisfied dependencies:
>
>commons-jelly-tags-interaction-1.0.jar
>commons-jelly-tags-http-1.0.jar
>
>Total time: 3 seconds
>Finished at: Thu Aug 17 16:18:09 CEST 2006
>
>markus_at_localhost:~/glassfish/entity-persistence-tests>
>
>
>Maybe someone knows the solution for that?
>
>Thanks
>Markus
>
>
>Eduardo Pelegri-Llopart wrote:
>
>
>>Thanks much Tom!
>>
>>Documenting this approach seems very valuable. If you give us a
>>pointer to how to do that we will add it to the persistence pages.
>>
>>Marina, could you help us with determining what tests need to be run
>>and how?
>>
>>Thanks,
>> - eduard/o
>>
>>Markus KARG wrote:
>>
>>
>>>Tom,
>>>
>>>thank you for your kind answer. Indeed what you wrote is the only thing
>>>I want to do *now* (maybe in future I will also contribute to other
>>>projects, but then the project structure might be 'corrected'
>>>meanwhile). So it would be great if you could send me your Eclipse
>>>project (you can just use the Eclipse EXPORT menu item) to be able to
>>>compile the entity-persistence and entity-persistence-tests. Also I need
>>>to know how to integrate the new .jar then into SAS9 to let it run (for
>>>a "real life" test).
>>>
>>>Thanks a lot!
>>>Markus
>>>
>>>Tom Ware wrote:
>>>
>>>
>>>
>>>>Hi Markus,
>>>>
>>>>I am one of the leads for the entity-persistence module and have been
>>>>doing my best to follow this conversation. I am not sure how much
>>>>help I will be, but I'll add some comments.
>>>>
>>>>I also struggled getting the build system going, so I feel your
>>>>pain. I am wondering if between Eduardo and I we can provide a way
>>>>that you can contribute to the entity-persistence part of the project
>>>>(so that you can allow MAX DB support in the Java Persistence API)
>>>>
>>>>I have used both Eclipse and JDeveloper to work on the
>>>>entity-persistence and entity-persistence-tests modules. I currently
>>>>have working Eclipse projects that allow me to work with these
>>>>projects.
>>>>
>>>>The entity-persistence and entity-persistence-tests modules very
>>>>minimal dependancies on the rest of GlassFish (they need to because
>>>>the specification says they have to be portable)
>>>>
>>>>I use CVS to check out the two modules mentioned above and have a
>>>>simple set of jars I depend on for compilation. My only real
>>>>interation with the GlassFish build system is to run the tests
>>>>(something I am hopeful that some of the folks at Sun can help you get
>>>>going with minimal pain.)
>>>>
>>>>Let me know if allowing Max DB support on the Java Persistence API is
>>>>what you were interested in doing (unfortunately other parts of the
>>>>project are out of my area of expertise). If that is what you are
>>>>interested in doing, I'll do my best to give you the details of how I
>>>>have every thing working in Eclipse and you can let me know if the
>>>>instructions are manageable. If we can get you to the point that you
>>>>can work in a reasonably simple manner, all that remains is to get the
>>>>tests up and running and hopefully Eduardo can give us some help with
>>>>that part of things.
>>>>
>>>>Let me know if this is of interest to you.
>>>>
>>>>Best Regards,
>>>>Tom Ware
>>>>
>>>>Markus KARG wrote:
>>>>
>>>>
>>>>
>>>>
>>>>>Eduardo,
>>>>>
>>>>>hope this will be soon, because I spent two more hours today in
>>>>>downloading the out-aged maven 1.0.2 on my machine and tried once more
>>>>>to get Glassfish built (following the rules on the Glassfish WebSite),
>>>>>but now maven is not working correctly, complaining about things
>>>>>non-maven-admins do not understand. So once more, I give up. If your
>>>>>project is ready for *FAST* contributing, I'll be glad to contribute
>>>>>then (please let me know by direct mail, since I will quite the
>>>>>subscription to this mailing list soon as it is of no more interest
>>>>>since I am not able to contribute my code). But until then, sorry, I
>>>>>need to prefer working around the missing MaxDB support in my
>>>>>application instead of contributing the MaxDB support to Glassfish.
>>>>>If I
>>>>>would have done so from the beginning, I would have saved more than
>>>>>once
>>>>>day of work. Sad, but true. As you see, now we're back as we had
>>>>>been on
>>>>>Monday: Still no MaxDB support in Glassfish, still not improved
>>>>>contribution process. I am sad about this, actually, but two days of
>>>>>frustration is enough. I am willing to spend my 20 years of experience
>>>>>in coding, but I am not willing spending more nerves on failing
>>>>>attempts
>>>>>to just compile the code. As you can seen, using maven not only has
>>>>>benefits. If the project structure just would be one src folder
>>>>>containing the complete source tree plus a simple build.xml, then you
>>>>>still would have modularization AND anybody could use Eclipse / ANT
>>>>>without spending days... :-(
>>>>>
>>>>>Markus
>>>>>
>>>>>Eduardo Pelegri-Llopart wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>Hi Markus. I certainly agree; but sometimes, in a very large and
>>>>>>complex project, making it easy is not that easy :-(. But we are
>>>>>>seing a spike in interest in GlassFish so we are going to try to
>>>>>>improve this in the near future.
>>>>>>
>>>>>>THanks, and please keep your interest in GlassFish
>>>>>>
>>>>>> - eduard/o
>>>>>>
>>>>>>Markus KARG wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>Eduardo,
>>>>>>>
>>>>>>>I have managed a dozen of open source projects on my own and know
>>>>>>>your
>>>>>>>problems certainly. But I learned one lesson very soon: If you
>>>>>>>have a
>>>>>>>lot of items on your stack and one of them is "make it easy for
>>>>>>>contributors to add their code", then do that before anything else.
>>>>>>>Why
>>>>>>>that? Because the easier it is to add small contributions, the more
>>>>>>>contributors will add code to the project. In turn, they will
>>>>>>>help you
>>>>>>>fix all the other items on your stack. If you do all the items on
>>>>>>>your
>>>>>>>own before making it easier to contribute code, then you will have
>>>>>>>to do
>>>>>>>all the work on your own while all the others cannot help you
>>>>>>>anything
>>>>>>>an get frustrated. I learned about that in my own projects, also in
>>>>>>>some
>>>>>>>projects I contributed to. So this is no critics, just a tip.
>>>>>>>
>>>>>>>If I find more time, I certainly will try out to contribute my
>>>>>>>changes
>>>>>>>for MaxDB (and maybe more) to Glassfish, but at the moment, I do not
>>>>>>>have the time to invest more time in the unnecessarily complex
>>>>>>>structure
>>>>>>>of the Glassfish code (in fact, the modularization is the main
>>>>>>>problem
>>>>>>>for Eclipse -- you have to add every single src folder manually,
>>>>>>>which
>>>>>>>needs hours of time).
>>>>>>>
>>>>>>>Have Fun
>>>>>>>Markus
>>>>>>>
>>>>>>>Eduardo Pelegri-Llopart wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>>It must be possible to download the code and type "ant" or press
>>>>>>>>>Eclipse's "build" button if you want to receive SMALL
>>>>>>>>>contributions.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>But
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>maybe you don't want them, actually?
>>>>>>>>>
>>>>>>>>>Thanks
>>>>>>>>>Markus
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>Yes, we want them. We are just your typical Open Source project:
>>>>>>>>there is always a long list of things to do.
>>>>>>>>
>>>>>>>>Let's see what others say.
>>>>>>>>
>>>>>>>> - eduard/o
>>>>>>>>
>>>>>>>>Markus KARG wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>As I wrote yesterday, I just want to spent a few hours
>>>>>>>>>contributing
>>>>>>>>>the
>>>>>>>>>code necessary to support MaxDB / SAPDB (which shouldn't be much
>>>>>>>>>more
>>>>>>>>>than editing a copy of the Sybase adaptor class).
>>>>>>>>>
>>>>>>>>>After spending three hours for downloading the Glassfish source
>>>>>>>>>and
>>>>>>>>>trying to convince Eclipse to compile, I gave up now. I don't have
>>>>>>>>>time
>>>>>>>>>to find out how to compile the source any longer. I read
>>>>>>>>>thousands of
>>>>>>>>>lines of how-tos for using Netbeans (which I don't have
>>>>>>>>>installed) and
>>>>>>>>>Maven (which I am not aware how to use) but there is no SIMPLE
>>>>>>>>>info on
>>>>>>>>>how to just let ANT or Eclipse run to get it built.
>>>>>>>>>
>>>>>>>>>Hey, remember, I just want to contribute one single class...!
>>>>>>>>>
>>>>>>>>>So is there a SIMPLE way to configure Eclipse to compile Glassfish
>>>>>>>>>available? Or is there build.xml I haven't found?
>>>>>>>>>
>>>>>>>>>I will neither learn how to use Netbeans nor how to administrate
>>>>>>>>>Maven
>>>>>>>>>just to contribute a class that is to be written in less than one
>>>>>>>>>hour. :-(
>>>>>>>>>
>>>>>>>>>So if there is no simple way to compile Glassfish or to
>>>>>>>>>contribute my
>>>>>>>>>code in another way, I am sorry, then I have to abstain from
>>>>>>>>>contributing to Glassfish (sad, but true, but my time is scarce).
>>>>>>>>>
>>>>>>>>>It must be possible to download the code and type "ant" or press
>>>>>>>>>Eclipse's "build" button if you want to receive SMALL
>>>>>>>>>contributions. But
>>>>>>>>>maybe you don't want them, actually?
>>>>>>>>>
>>>>>>>>>Thanks
>>>>>>>>>Markus
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>
>>
>
>
>

-- 
Tom Ware
Principal Software Engineer
Oracle Canada Inc.
Direct: (613) 783-4598
Email: tom.ware_at_oracle.com