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

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.

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.

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

Configuration required to Run Maven project with Eclipse

I have a Maven project in SVN with trunk\Config\TestProjConfig folder having all the XML configuration files and all Java code is in trunk\JavaSource\TestProj. When I check out to my local Eclipse there are 2 projects created one for TestProjConfig and one for TestProj.
How do I test this project? Do I have to edit the build path to make a connection between the two projects? Do I have to write a main class which accesses the AppContext file to invoke the Spring injections?
Note:I have the m2eclipse plugin in Eclipse.
I don't understand why you separated XML configuration from Java sources. It could be a good practice only if you want to reuse your conf in other project, but in this case, I'm not sure that's suitable.
Solution 1
Move all your xml config into JavaSource\TestProj\src\main\resources
If you really don't have to share your configuration or don't have any legacy / corporate / mysterious reason, you should not separate them.
Solution 2
If you REALLY want to separate them, put them in a zip with an assembly, and add a dependency from TestProj to TestProjConfig.
Here an example : Maven - Depend on assembled zip

What is a reasonable way to convert a complicated Ant script to a set of Eclipse projects?

I inherited an existing Ant build script. It invokes javac three times on three different source directories: shared, client, and server. It then produces two JAR files: client.jar (shared + client) and server.jar (shared + server).
When I translated this to Eclipse, I ended up making three projects with appropriate dependencies. This works, but I'm not a fan of the Eclipse project explosion (this was an easy case; I have about a dozen such ant scripts, and some would turn into 6 or 7 Eclipse projects).
My question: is there a better way?
I should also mention that I don't want to simply create one Eclipse project with three source directories. That's not the way that Ant compiles the code, and it would make it harder to find cases where people were using classes from an inaccessible source tree (using server classes from the client code). (I also happen to have classes with the same name in client and server, so I actually can't just dump all the source together.)
We have a similar project set up: 13 eclipse projects each with their own ant scripts. 7 of them are shared and produce JARs the other 6 are webapps that get packaged in to WARs. The ant script for each of the WAR-producing projects invokes the build in its dependencies and sucks the generated jars in to the lib. So, no, we don't have a better way, but I have a fuzzy vision for how things could be better if we switched from ant to maven:
The 7 shared projects change much less frequently than the webapps. I would like to publish those shared project JARs to our own repo and then for each of the webapps specify which version of the dependency they need and let maven handle getting it for us. That way we wouldn't need to have all of the JAR projects open in Eclipse unless we were making changes to them.