Using Maven with JBoss soa platform - maven-2

We have a jboss soa platform license and want to start using Maven for our projects and services. We started working on samples and were able to create simple multi module projects successfully. But I see that every time Maven connects to a central repo and my understanding from the docs is that the dependent jars are by default downloaded to the .m2/repository. But, the problem is we want our projects to use the jars that comes with our jboss soa platform. I see the Maven website page that shows how to add 3rd party jars, but adding all the jars that comes with a distribution would be time consuming and cumbersome.(especially finding the groupId and artifactIds for every single one of them) 1.) Is there an easy way to do this? 2.) I think we still have to go to the Maven central repo to get all other plugins(like maven-war-plugin, jar-plugin etc..), right?(because our JBoss platform doesn't come with those).
Appreciate the suggestions. It will help us greatly in starting off in the right direction.

I am no expert on Maven but this should be possible by using the scope and set it to provided.
See the Maven Doc on the scope for more info.
It is meant to indicate that the dependency is provided by a container.

Related

How to ensure eclipse plugin has required bundles available?

I'm just starting to develop a new eclipse plugin where I want a web application server running in Eclipse. I found a nice blog, OSGi as a Web Application Server, that describes how to do this. The author suggests creating a target environment for my bundle requirements, and some of those bundles get pulled in from the Equinox Project SDK (now called Equinox Target Components in Juno). I notice that the tutorial project runs fine when my target platform is the platform I created in the tutorial, but fails to start when it is the default platform. So, now for my question...
If I need bundles that are not part of the default, how will my plugin project get access to those bundles? Will I need to deploy them along with my plugin? How would I know if the user's eclipse does or does not already have those required bundles?
You was not much clear about what kind of application you are developing. Running a web server in an Eclipse IDE as a plugin don't make any sense to me. This kind of server application is best just running on top of Equinox.
Anyway, the right path is to create a "Product Configuration" file and add categories that contains the needed bundles (go to File/Plug-in Development/Product Configuration).
With this file you can run an instance of the product (inside the IDE) and can export it (create a zip containing all needed bundles)
And if you want to able your user to install plugin inside his IDE you must create a P2 repository (using a Target Definition File) and expose the exported directory within a Http server. You could research about Tycho to build this kind of components in a maven style.
Well, I'm not sure if re-inventing the wheel again is really sufficient.
You might take a look at Pax-Web for inspiration on how to do it, or take a look Apache Karaf as a OSGi-Container (using Pax-Web). Or even better start contributing to one of the two :-)

m2eclipse and RAD 7.5

I am using Maven to automate a project that is being developed in RAD 7.5.
I've installed m2eclipse in RAD 7.5 , updated ( manually ) maven dependencies , and it builds Maven way within RAD.
My main question : what is the best practice using m2eclipse with RAD?
Should we keep both ( RAD and maven ) settings in the project workspace or remove all RAD settings and stick with Maven only?
Also , I am wondering about m2eclipse dependency management feature. I was hoping that it will update pom.xml with the new dependency when I add it to the classpath and vise versa ( in case we are keeping both configurations ). Is this a correct assumption?
this doesn't seem to happen. Maybe I need to give it another try....
Any suggestions are very much appreciated!
The article "Java EE development using Rational Application Developer 7.5.5 and Maven" (http://www.ibm.com/developerworks/wikis/display/rad/Articles) is OK but the site is wrong.
Since RAD 7.5.5 is based on Eclipse 3.4.2 you need to point here:
http://m2eclipse.sonatype.org/sites/m2e-e34/
My main question : what is the best practice using m2eclipse with RAD? Should we keep both (RAD and maven) settings in the project workspace or remove all RAD settings and stick with Maven only?
I don't work with RAD so I'm not sure my answer will be totally accurate but when working with Eclipse, m2eclipse takes care of the .classpath and the .project files and everything is derived from the pom.xml, not the other way around. I don't think it's different with RAD.
[...] I was hoping that it will update pom.xml with the new dependency when I add it to the classpath and vise versa (in case we are keeping both configurations). Is this a correct assumption?
I don't think so, m2eclipse won't translate a random dependency (that may not be available in any repo) into a maven artifact and add the coordinates to the pom.xml. Edit the pom.xml or use the wizard to add a dependency. As I said above, it works the other way around, things are derived from a pom.xml.
As there seem to be many open issues with m2eclipse (at least 0.10+) and RAD 7.5, I'm thinking of going the manual way in RAD with the eclipse:rad goal:
http://maven.apache.org/plugins/maven-eclipse-plugin/rad-mojo.html
Please to go to http://www.ibm.com/developerworks/wikis/display/rad/Articles
See section Java EE, article "Java EE development using Rational Application Developer 7.5.5 and Maven".
This is a best-practices paper published by Rational Application Developer development team.
Be aware that the comment from Pascal might have performance implications during publishing to WebSphere Application Server or WebSphere Portal Server.
The developerWorks forum for Rational Application Developer contains also quite a number of posts.
The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM.

Maven Project - github

Is it possible to publish your site reports to github? For instance, I run Checkstyle, Findbugs, Cross Reference, and other plugins and would like to have that publicly available. Since my project is already there, I'd like to just keep it there.
With the state of the plugins that exist now, you'd have to do some shimming. The site command (per your comments: wanting to use mvn:site) has a mechanism (stage) for pushing the resulting site somewhere, but it's all mostly predicated on SCP'ing it around to some final destination. For github, I don't think there's any obvious place to land things like that.
The solution would be to write something that extended the site plugin to check in the results to Github using the github pages functionality. Details on the github pages bits are available at http://pages.github.com/. To get there, you'll be writing something that checks in your resulting site to a root branch "gh-pages" and going from there.
There are maven github plugins wich works fine for me.
feature:
deploy artifacts
download artifacts
deploy site to gh-pages
See: https://github.com/github/maven-plugins and fork the example project at https://github.com/kevinsawicki/github-maven-example to try out.
The Maven way to publish your reports would be to build the Maven site and to deploy it using FTP, SCP or DAV.
I don't know if GitHub provides hosting space and supports any of this protocol. If it does, then the following resources will help:
Deploying a Site in the site plugin Usage page
10.6. Deploying Your Project Website
Maven 2: Getting "mvn site:deploy" to work
Releasing Maven projects to Github
Site Distribution in the POM Reference
If it doesn't, better look for another place to host your site.
I'm using this plugin for that: http://synergian.github.com/wagon-git/

Use maven2 for build-automation and continuous integration of an eclipse rcp project?

My company starts a new project next week. We have planned to develop the application with eclipse rcp. The build process should be fully automated, so we're prepared to set up a continuous integration environment (e.g. Continuum). For the build-automation-part I intended to use maven2, because I want use its dependency management.
I have used maven2 for a small old-style java project, but have never set up maven for using it with eclipse rcp.
What's the best way to do this? Basic concepts? Common traps? Are any tutorials or book's around there? The tutorials and informations I found, seemed outdated or incomplete.
PS: The main project will be divided into sub-project's (plug-in's). But I think this is typical for eclipse rcp projects.
You should take a look at Tycho:
the-future-of-maven-osgi-join-the-tycho-users-mailing-list
the-next-generation-of-build-tools-for-eclipse-plugins-and-rcp-applications
Like most Maven questions, this is solved by a link to a plug-in:
"pde-maven-plugin"
Other advice:
use the assembly plug-in to build
the update site
consider using hudson rather than
Continuum
I've been battling maven2/Eclipse RCP integration for some time. The key is not so much getting your setup right: You can get it to work - eventually - by reverse-engineering Eclipse's build process in maven.
In my experience, the hard part is keeping everything up to date. Every time Eclipse revs their libs, you'll find yourself re-writing a bunch of pom files for that newest RCP widget or SWT lib. Naturally, CI helps with this somewhat. The problem is that Eclipse and maven are very particular about the way they do the business of building, and their approaches are quite different. To make matters worse, PDE dev (and Eclipse dev, more generally) is powered by a lot of wizard code, which is sometimes quite opaque as to what's happening behind the scenes.
The question you really need to ask yourself is if it's worth the effort. In my particular case, I believe it has been. (CI is too good to live without.) But the trade-off is that you may find yourself being the "build guy", which can take valuable time away from actual development, which is probably what you enjoy most.
I've got recently the same problem : build eclipse RCP application through continuous integration.
I haven't applied them yet but I've found some interesting articles :
Here's the documentation for Tycho
Building Eclipse Plugins with Maven 2 on eclipse.org
Build Eclipse RCP products using Maven 2 - how hard can it be? from Immo Hüneke's blog
Here's an article about PDE build automation
Here's a shell script to automate JUnit test launch

Is this the right approach for structuring codebase?

We have a Java codebase that is currently one Web-based Netbeans project. As our organization and codebase grows it seems obvious that we should partition the various independent pieces of our system into individual jars. So one Jar library for the data access layer, one for a general lib, one for a specialized knowledge access, etc. Then we'd have a separate project for the web application, and could have one for a command line tools app, another web app eventually, etc.
What is the recommended practice for doing and managing this? Is it Maven? Can it all be effectively done with just Netbeans alone by simply creating individual projects and setting the dependecies of one project on the jar files of the others?
I'd agree with SteveG above on using Maven2 to help you modularise your code base, but I'd use Nexus as the local repository for Maven instead of Archiva. The guys at Sonatype also have an excellent (free html/pdf) book on how to use Maven, Nexus, and integrate it into IDEs.
Be careful on how you decide to partition up your projects, though. There's no sense in over-complicating your dependencies just for the sake of it.
I would definitely say check Maven(2) out. It is very good for doing this sort of thing. You can define individual models and version then very easily. Netbeans also does a decent job of integrating with.
Also I suggest you set up Archiva which will let you be dependent upon binaries of other artifacts that your company generates internally. This also acts as a proxy and will keep a local copy of any external dependencies your projects might have so its very quick to get the new versions internally.
I would create ant scripts to build the pieces and for deployment. Then you are not depending on your IDE for build/deployment.
It sounds like your code is getting to the point where you're graduating from the WAR approach and have entered into the EAR level.
An EAR is just another archive that contains all the other JARs and WARs that get combined to create an application. There are four types of modules that can reside inside it, Web, EJB, Connectors and Utilities. Most people only use Web and Utilities so they go with using the WEB-INF/lib approach.
But if you're starting to get a lot of interdependencies what you do create an EAR project and make your web project a child of it. Each Utility JAR which is just straight Java code used by other modules also becomes a child of the EAR. Finally in each of your projects there should be a META-INF/manifest.mf file that just has the name of the JARs that JAR/WAR depends on.
I'm an eclipse guy and most of this gets taken care of for you in eclipse, but I'm sure netbeans has very similar functionality.
Now the only problem is that you have to use a full Java EE server to deploy an EAR so I don't think you can use Tomcat if that's what you're currently using.