jspresso & eclipse

Hi All, how can I integrate jspresso application developing in eclipse (3.4)? I'm trying to organize a project structure from HR sample apllication with any success. Could you provide a sample eclipse project for HR application?

jspresso & eclipse

Hi,

First, thank you for your interest in Jspresso.

We are currently in the process of writing a step-by-step trail for cleanly configuring Eclipse (currently Ganymede) on a Jspresso project. This trail should be ready during the week-end (maybe today) and the Tutorials section will be updated accordingly. We will post a follow-up as soon as this is done.

 

Best regards,

Vincent

Jspresso Project Leader

jspresso & eclipse

As promised, a new section has been added to the site. We are looking to integrate the eclipse project configuration files in the Jspresso archetype.

Best regards,

Vincent

jspresso & eclipse

Just a quick follow-up to inform you that the tutotial trail on Eclipse integration has been greatly simplified.

We have just deployed a new version (1.3) of the Jspresso archetype that includes all the necessary Eclipse configuration along with the project generation (sourcepath, classpath, WTP module, Spring IDE config) and even pre-packaged launch configurations ready to be imported. Getting a Jspresso project generated by the archetype into Eclipse is almost just an import now.

Moreover, we have refactored the HR sample application so that its structure and name conventions match exactly the ones of an archetype generated project. Importing the HR sample sources is only copying 2 directories into the generated project. The latest HR sample application (1.2) source distribution with this fixed structure is available for download in the download area.

 

Best regards

Vincent

jspresso & eclipse

I'm working avec jspresso under Eclipse.
Each time I change something in model.xml, I have to go through:
- ant generate-entities
- ant xdoclet-hibernate
- mvn package
- ant clean-hibernate
- and update (F5) the project under Eclipse
I wrote an ant target to do it from under Eclipse so it isn't really a problem. But I think it should be simpler.
Did I miss something?
 

jspresso & eclipse

Hi,
 
When modifying model.xml, you should only need to do:

  • ant clean-hibernate (only if you got rid of some entities in the model and want to delete the corresponding hibernate mapping files)
  • ant generate-entities
  • ant xdoclet-hibernate
  • F5 on your project

There souldn't be any need for "mvn package".
 
Moreover, those steps are only required if you change something that relates to the persistence mapping (adding a new entity, adding a property on an entity, changing relationships, ...). There are still many cases when you may act on your domain model without any requirement for re-generating your entities. Examples of such modifications are :

  • enforcing a constraint on a property
  • registering interceptors on properties
  • setting an icon image for an entity
  • changing an entity default queryable or rendererd properties
  • ...

Having said that, it is fair to agree that Jspresso lacks a designer (an Eclipse plugin ?) that relieves the developper from these tasks (and of Spring development with Spring IDE). This is on our roadmap but we need to get some Eclipse skills on board. Another idea was to make the designer a Jspresso application working on the Jspresso metamodel but it might be far less developer-friendly (no nice graphic things, no seemless integration in eclipse).
We are surely open to any contribution on the topic.
 
Hope this helps,
Regards,
Vincent

jspresso & eclipse

After adding some attribute on an entity, if I do:

  • ant generate-entities
  • ant xdoclet-hibernate
  • F5 on the project

then when I launch the application under Eclipse, I get an exception:
 
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateTemplate' defined in class path resource [org/jspresso/framework/application/backend/persistence/hibernate/commons-hibernate.xml]: Cannot resolve reference to bean 'hibernateSessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateSessionFactory' defined in class path resource [org/popsuite/hr/config.xml]: Invocation of init method failed; nested exception is org.hibernate.DuplicateMappingException: Duplicate collection role mapping org.popsuite.hr.model.Branch.workers    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)
[...]
Caused by: org.hibernate.DuplicateMappingException: Duplicate collection role mapping org.popsuite.hr.model.Branch.workers    at org.hibernate.cfg.Mappings.addCollection(Mappings.java:124)    at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2066)
[...]
 
If now I do:

  • mvn package
  • ant clean-hibernate
  • F5 on the project

everything runs fine...

jspresso & eclipse

Hi,
Once again, you are right ;-)
 
It should work as described but it doesn't. This comes from the fact that the Jspresso archetype Eclipse project is configured using a directory symbolic link webapp/src/main/webapp/WEB-INF/lib that points to the WEB-INF/lib directory of the maven build.
 
This has a big advantage over one-by-one webapp library configuration : the Eclipse project doesn't change when the webapp dependencies change (either a new dependency or a dependency version upgrade) since Eclipse will automatically consider all the jars in the webapp/src/main/webapp/WEB-INF/lib symbolic link as a webapp library. This is a rather "cheap" way of keeping the maven dependencies in sync with the eclipse project without having to deal with extra plugings.
 
The problem comes from the fact that maven also builds (of course...) your application jars and put them in the application WEB-INF/lib directory, thus making them a library of the Eclipse project. And now, your application classes and resources are referenced twice in the project (from the project build path and from the maven generated jar) thus generating DuplicateMappingExceptions and forcing you to perform all the extra steps you described.
 
Instead of doing a "mvn package" and "ant clean-hibernate" each time you modify the model.xml, just navigate to webapp/src/main/webapp/WEB-INF/lib and delete the maven project generated jars (e.g. yourapp*.jar). Do this every time you "mvn package" your application (should'nt be too often in development since you would "mvn package" only for releasing the war outside of the development environment). Now, you will be able to work directly from your project sources the way described above. Still have to check how we can get rid of that...
 
Hope this helps,
Vincent

jspresso & eclipse

Thank you for your quick answer.
I'm working under Windows XP. When I tried to delete the project jar files under
{project.home}/webapp/target/{project.name}-webapp-1.0-SNAPSHOT/WEB-INF/lib
 
I get an error message "Unable to delete file" from Ant. Windows locks the files...
 
Any workaround?
 
 

jspresso & eclipse

Do you have tomcat started in Eclipse ? If yes, stop it, then try again. If it still does not work, maybe Eclipse itself is locking it (then quit Eclipse...). To investigate further, you might download process explorer (http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx). It can give you the name of the process that holds a handle on your file (Menu File -> find handle or DLL, then type in the jar finename).

jspresso & eclipse

I'm quite lazy and don't mean to investigate :) I just tried http://ccollomb.free.fr/unlocker/ from the build.xml. It works fine. So...
Thank you for the link. For the next time...

jspresso & eclipse

By the way, I use a Tomcat 5.5 as server to test jspressso. But no server was running as atm i'm testing only the Swing version.
So IMO it's Eclipse which is locking the files.