develop on jGuard with Eclipse

it is required to install maven 2 and include it on your path.

jGuard sub-directories as Eclipse projects

when you have created your svn repository related to jGuard(https://svn.sourceforge.net/svnroot/jguard/jguard), you need to navigate into the trunk subdirectory. you will find these directories:

  • jguard
into this directory, you will have these subdirectories:

  • jguard-core
  • jguard-ext
  • jguard-ext-java-5
  • jguard-jee
  • jguard-jee- extras
  • jguard-struts-example
  • jguard-swing-example
right-click on each directory in the svn repository explorer perspective, and select 'checkout as'. it will create for each directory an eclipse project.

working on trunk and branches

if you work on the trunk and in a specific branch, we recommend you create some working sets :

one for the trunk, and one for each branch.

each working set will contains all the eclipse projects owned by these trunk/branches.

for example, you can create a working set intitled jguard-trunk , and another one intitled jguard-branch_1.0 .

in the same way, it is a good practice to prefix the projects in each working set.

for example, you can create these eclipse projects like this: for the jguard-trunk working set, you can create the projects:

  • trunk_jguard
  • trunk_jguard-core
  • trunk_jguard-ext
  • trunk_jguard-ext-java-5
  • trunk_jguard-jee
  • trunk_jguard-jee-extras
  • trunk_jguard-struts-example
  • trunk_jguard-swing-example
eclipse_trunk2.png

in the same way, for the jguard-branch_1.0 working set:

  • branch_1.0_jguard
  • branch_1.0_jguard-core
  • branch_1.0_jguard-ext
  • branch_1.0_jguard-ext-java-5
  • branch_1.0_jguard-jee
  • branch_1.0_jguard-jee-extras
  • branch_1.0_jguard-struts-example
  • branch_1.0_jguard-swing-example
eclipse_branch.png

declare the M2_REPO variable in eclipse

your maven 2 local repository location should be referenced with the M2_REPO variable.

to declare this variable, go to window > preferences > java > Build Path > Classpath variables > new

m2repo.png

build paths for projects

  • configuring source folders in the build path
configure source folders to respect the maven 2 convention (src/main/java).

buildpath_source.png

configure libraries folder in the build path

to add a library, in the libraries folder, you have to click on add variable > select M2_REPO > extends > select the jar to add .

it permits to use the same libraries officially released with maven 2, and be independant of the location of the local repository.

buildpath_libraries.png

to be shipped in a webapp, each library have to declare some facets : right-click on the project > properties > project facets > add/remove Projects facets : add the java facet 1.4 (1.5 for jguard-ext-java-5), and the utility facet.

projetfacetsutility.png

build paths for webapp projects

webapp sources need many libraries to be compiled.

most of them will be shipped in the webapp Archive (i.e war), but someone like servlet.jar/j2ee.jar or junit.jar are already present in the application server, and must not be shipped in the war file.

in the webapp example, junit.jar and servlet.jar will be used for compilation (jars present in the M2_REPO will be used) but not shipped in the war archive, and other libraries will be declared as j2ee dependencies.

webappbuildPathlibraries.png

other projects like jguard-core or jguard-ext have also to be declared as j2ee module dependencies.

you can only do it if you've added to these projects the java and utility module facets described above.

j2eemoduledependencies.png

execute the webapp on an application server from Eclipse

you have to register your application server in the servers view.

add your webapp project to the server : right-click on the server registered in the servers view, and select add/remove project.

right click on your project, and select *Run As > Run on server *. to launch the application server in debug mode, right click on your project, and select *Debug As > Debug on server *.

Version 1.52 last modified by Charles Gay on 11/02/2007 at 13:46

Comments 0

No comments for this document

Attachments 8

Image
m2repo.png 1.1
PostedBy: Charles Gay on 10/02/2007 (69kb )
Image
eclipse_trunk2.png 1.1
PostedBy: Charles Gay on 11/02/2007 (33kb )
Image
eclipse_branch.png 1.1
PostedBy: Charles Gay on 10/02/2007 (34kb )
Image
buildpath_source.png 1.1
PostedBy: Charles Gay on 10/02/2007 (99kb )
Image
buildpath_libraries.png 1.1
PostedBy: Charles Gay on 10/02/2007 (119kb )
Image
projetfacetsutility.png 1.1
PostedBy: Charles Gay on 10/02/2007 (78kb )
Image
webappbuildPathlibraries.png 1.3
PostedBy: Charles Gay on 11/02/2007 (84kb )
Image
j2eemoduledependencies.png 1.1
PostedBy: Charles Gay on 11/02/2007 (142kb )
 

Creator: Charles Gay on 2006/06/28 17:32
jGuard team copyright 2004-2007
1.1.1