How do you organise your ATG projects? - atg

If you develop for ATG Dynamo, how do you structure your modules and dependencies?
How do you structure the projects? source directories, JARs configs etc.
How do you build and deploy? What tools do you use?

We have a monolithic architecture with a single ATG module. We originally developed this site with JHTML and have since created a (monolithic) J2EE web app within this ATG module and converted all of our JHTML to JSP.
Our project on disk looks like this:
root
deploy
class (compile java to here)
config (primary configpath)
docroot (JHTML docroot)
dev (configpath for dev environment)
test (configpath for QA environment)
prod (configpath for prod environment)
j2ee (j2ee web-app)
WEB-INF
dir-a (application JSPs)
dir-b (application JSPs)
src
java (java src)
sql (sql src)
We have an Ant build file that compiles the Java source to deploy/class. On dev/test and prod JAR up. We have a single build server that checks out the CVS repository and uses shell scripts and the build.xml to compile and deploy to the requested server using Interwoven OpenDeploy (essentially rsync).

Most structures look like the ones mentioned above with minor changes.
We use MAVEN to build and deploy.

Here is the layout that we use:
root
src (java src)
test/src (unit test)
build (directory created by ant)
classes
config
javadoc
lib
liveconfig
buildlib (libraries used for building)
config
install (holds items used for different IDE)
j2ee-apps
lib (libraries used by the application)
sql
oracle
data
install (tables, indexes etc)
setup (create tablespace, users etc)
uninstall
delta (changes during development)

Very similar to the above (no Maven). Plus the groovy directory - we use lot of groovy scripts for deployment/building related task (Ant in combination with Antbuilder)

Related

Eclipse virtual application deploy Vs ear deploy

I have a Java EE web application written in Eclipse and deployed on WebLogic.
When I deploy it from Eclipse (as a virtual application) it works fine. When I try to create an EAR file and deploy it from the WebLogic console I get a ClassNotFoundException.
What could be the reason?
How can I create an EAR file that will match the structure of the virtual application so it will work?
Usually this means a dependent library is not being deployed. This tends to be where Eclipse has a dependency which it fulfills as part of the internal build. When building it yourself, work out which libraries you need, and which are part of your application, and which are part of WebLogic. For your own libraries (ie those in the lib folders, or those that SHOULD be in the lib folder) make sure they are on the classpath. For external libraries, ie those WebLogic fulfills, make sure you have the appropriate schema descriptors setup to tell weblogic which libraries it needs to deploy with your application (typically things like JSF).
If you want proper control over the build, take a look at things like Ant. You basically tell it via xml what is needed, put it together, and it generates the Ear/Jar file for you (the Ear file containing all the dependencies as well, and/or with your descriptors for weblogic built in libraries).
If you are planning many builds, I find Ant useful once setup (you can tie it in with other programs too, so it can push a build to your Source Control Server as a tag, build documentation, etc). Ant can be a pain though- you need build descriptors for each library you need to build, as well as the Ear file.

How to configure output folder for ejb stubs in RSA "prepare for deployment"

I would like to configure the output folder for the generated EJB stubs for WAS 7.0 when doing a "prepare for deployment" in RSA 8.0.
Currently the sources of the generated stubs are generated to the normal source folder of the eclipse project. Because of that generated and manually edited code is mixed. That's why I can't easily create SVN ignores for these generated files. So I would like that these files are generated to another source folder ejbmodule-gen instead of the ejbmodule source folder that contains the manually edited sources.
In the preferences I'm able to set the output folder of an EJB Project under Java EE -> Project. However this does not have an effect.
I could also use some more elaborate patterns for SVN ignores. But I don't want to mess around with them as they are already repeated much too often in build files and other places in the project.
So how can I make sure that selecting Java EE -> Prepare for Deployment will put generated source files to another folder than the original source folder of the project?
I am afraid that for EJB 2.1 the following limitation holds on Rational version 8.0:
Multiple output folders are not supported for EJB projects
However if there is enough flexibility in the project I would recommend to manually use the createEJBStubs Websphere command to generate the EJB stubs or (better) to use an ANT (or whatever) build script to build the binaries per your preference.

Eclipse Maven multi project build/deploy process when using a SCM/Audit group

Ultimately we are trying to figure out a build/deploy process at my company. As the developer, I need to provide my source code to an audit group. They review the software for security deviations. If the source passes the audit, then the code goes to the Software Configuration Group. Their job is to archive and compile my app to a WAR. The WAR file is then provided to the IT department who will put the WAR on the server. I think the process would be easy if I had one self contained project.
But in Eclipse I have two Maven projects, where one depends on the other. One project core provides core functionality. I separated it because these core functionalites will be used by all my other (internal) web app projects.
Logging
filters
common models (phonebook, employee, etc)
common utilities (Emailing employess, String utils, etc..)
In the other projects, say project1, I add a dependency to core in the POM. Not sure if I need to do this but I also edited the Eclipse project properties and added a reference to the core project. With some finagling (new to Maven) I was able to get Project1 deployed to my local install of JBoss. I opened the WAR and in WEB-INF/lib folder I could see that core-0.0.1-SNAPSHOT.jar was automatically included.
But how do I give SCM my source for project1 which also needs the source for core without manually copying cores source into porject1s source.
I could copy core-0.0.1-SNAPSHOT.jar into Project1 but they should also be reviewing cores source every time I deploy a new app because I may have added or tweaked some core functionality.
You should learn more about maven SNAPSHOT and release repositories. Then install Nexus server as destination for produced jars, wars, javadocs and sources (called artifacts).
After that maybe you will be interested in commercial Nexus version with staged deployment option.
http://www.sonatype.com/people/2009/06/using-staging-repositories-for-deployment-in-nexus/
To solve packaging problem you can use Maven Assembly Plugin. You can have all sources and dependencies in one file.
Maybe there are even more suitable for your needs maven plugins.

Automating build tasks using eclipse / maven m2e

I am about to use maven to automate my builds. Unfortunately, I am not able to get all the features I want, even after reading several tutorials :(
I would be glad if somebody could explain a way I can achieve all my goals!
I want to automate 3 specific build tasks with several actions for a project from within eclipse, using m2e:
Build snapshot
compile
define current project version + date as version
build jar file
copy jar file into the local repository in the project path itself (ยง{project}/builds/)
Debug snapshot
build snapshot as mentioned above
copy jar file to plugins folder of a local test server
build another project the current project depends on, copy its jar file to the plugins folder aswell
launch server / connect to eclipse debugger (I know how to do that, the previous steps are the important ones)
Create release
compile
define current project version as version
build jar file
copy jar file into the local repository in the project path itself
create javadoc
copy source files and javadoc to an archive folder
increase the project version (for example v6 -> v7)
As mentioned I don't need a perfect solution, just a way to realize this ;)
(Annotation: Chaining multiple launch configurations is not a problem.)
Edit:
Which sections of the pom.xml do I have to modify to realize these steps and how can I invoke them using an eclipse launch configuration?
Hi based on your requirements i can say the following:
Build Snapshots
Building a SNAPSHOT is usually the convention during development cycle.
1.1 just using the conventions.
1.2 Date as version
This is a bad idea, cause Maven has some conventions how a version looks like (1.0-SNAPSHOT or 1.2.3-SNAPSHOT etc.)
1.3 Build jar file
Usually done by the jar life cycle (mvn package)
1.4 The local repository is on your home drive in ${HOME}/.m2/repository for all your projects. Technically you can do what you like but it's against the Maven conventions. The question is why do you need such thing?
2.1 Usual procedure
2.2 Usually a deployment is not a job for Maven but you can do such things by using cargo-maven-plugin (integration testing).
2.3 If you have dependencies between project you need CI solution like Jenkins to do such things otherwise you need to do this manually. But that is different from a multi-module build.
2.4 Integration testing different story. Depends on what exactly you like to do.
3.
1-7
The maven-release-plugin will handle such things except copying to the project path itself which is against the conventions. For such purposes you need a repository manager.
I can recommand reading these books: http://www.sonatype.com/Support/Books

How to set up JRebel in a Tomcat environment

I'm having a hard time getting JRebel to work in my current development environment.
I have multi module maven projects. Currently, the Tomcat instance is controlled via service (tomcat monitor) and the deployed web apps are configured with a XML located at ${catalina.home}/conf/Catalina/localhost where the docBase attribute points ${absolute maven project path}/target/app (and the attribute reloadable is true). So every time I do a maven build I only have to manually restart tomcat if there any classes changed. If the modifications occurred in the static resources (JSP, HTML, JS,
etc..) a page refresh will do it.
On my first attempt, I configured the web apps to run on a tomcat server running inside Eclipse. The maven plugin provided was also configured with success: all my sub-modules inherited the plugin configuration and I can saw in the tomcat startup the output messages from JRebel indicating the absolute project paths that were been listen. The only problem is that Eclipse WTP / Tomcat plugins don't go weel with War overlay feature in eclipse. After starting the server, only the resources present in the last web app (the module that have other War as dependencies) were deployed.
So, I returned to my original configuration development and introduced JRebel to it. I passed the JRebel java options to the Tomcat Vm, all maven modules had the rebel.xml (listening to the correct resource folders), but nothing happens. I can't see the usual JRebel messages and I experimented changing a JSP in the source folder and do a page refresh but the file ins't automatically redeployed (in this case a simple copy from the source folder the the ${maven.projec}/target/app will do the trick).
My two questions are:
It's possible to over come that eclipse WTP issue?
What is a funcional development environment involving maven eclipse and a external tomcat?
Any help would be much appreciated!
UPDATE 1
So, I got it. Kind of...I'm still struggling with the war modules overlaying. I have a main web app module that depends on several webapps modules. Because the rebel.xml it's generated dynamically via jrebel maven plugin when the main webapp build occurs, only the it's jrebel.xml prevail. All the other are squashed. The rebel.xml for the jars modules are at the right places (inside the jar file).
I can get it work if I create a custom rebel.xml for the main webapp that points to all the absolute directories containing the source files (static files such as JSP, HTML, JS, CSS, images, etc.) of the depending web apps. But this is worthless for my team development environments. I'm using maven properties but we've have two different maven multi-module hierarchy that don't know about each other and I can't use a root pom to connect them. So these kind of properties will not be enough to guarantee that the absolute paths generated on each developer machine in the rebel.xml are correct.
For now, I'm trying to tackle using some kind of maven plugin to do the rebel.xml merge. For the record without success yet.
This is becoming another issue a bit different of the original question :) Maybe I should through another question.
UPDATE 2
I got it working!..finally.
I used the XSLT Generator Maven Plugin to help me merge the various rebel.xml files. Also had to use the fabulous Maven Copy Plugin because the xslt transformation occurred after the final war packaging and I had to add the resulting rebel.xml to that WAR.
If someone needs the configuration files details down't hesitate asking.
Hope's this helps someone out there.
I got it working!..finally. I used the XSLT Generator Maven Plugin to help me merge the various rebel.xml files. Also had to use the fabulous Maven Copy Plugin because the xslt transformation occurred after the final war packaging and I had to add the resulting rebel.xml to that WAR.