Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add all artifacts from JBoss Maven repo to Maven project in Eclipse

I'm using JBoss EAP 6.0.1 (NOT JBoss AS 7.1.1 or 7.1.3!) and I'm just starting with a Maven project.

In normal Eclipse projects I set the target runtime of my project to the JBoss EAP server runtime and then all its libraries are available to my project. Available here means I can use e.g. ctrl-t to find a class in any of those libraries, and when I attach the source I can step into them when debugging.

How would I do this using Maven (m2e)?

I've found the Maven repository for JBoss EAP 6.0.1 at http://maven.repository.redhat.com/techpreview/eap6/6.0.1/

Do I need to add some root dependency (representing JBoss EAP itself) to my project, and if so, what would this dependency be?

I found a very similar question here: Adding JBoss AS 7 modules on Eclipse using Maven or JBoss Tools

But the accepted answer only says: "Take a look at these links", which doesn't tell me how to exactly do this (and it's for AS 7.1.1 not for EAP 6.0.1).

UPDATE

I wasn't entirely clear about the question. I'm not looking for a mere reference to the Java EE APIs. I know how to do that, as it's simply:

<dependency>
    <groupId>javax</groupId>
    <artifactId>javaee-api</artifactId>
    <version>1.6</version>
    <scope>provided</scope>
</dependency>

I'm also NOT looking for any vendor versions of that spec jar. I'm absolutely NOT looking for the following one either:

<dependency>
    <groupId>org.jboss.spec</groupId>
    <artifactId>jboss-javaee-6.0</artifactId>
    <version>1.0.0.Final</version>
    <type>pom</type>
</dependency>

What I'm looking for is having all implementation libs available in the project. The JBoss AS 6 server runtime does this by default, and with the JBoss AS 7/EAP 6 server runtime you can do this by going to Server -> Runtime Environments -> Default Classpath (you can enter individual paths there, or just add the /modules rootpath to have everything at one)

I'm looking for the equivalent of this in a Maven project.

I'M NOT LOOKING FOR SPEC JARS!!!!

As I need to step through the ACTUAL IMPLEMENTATION jars of the target server, I REALLY need the ACTUAL IMPLEMENTATION jars. I KNOW I can't deploy these, and nor do I intend to deploy them. They need to be present in my IDE, so there's source code that matches what's in the target JVM and I can use CTRL-SHIFT-T to lookup IMPLEMENTATION classes and CTRL-CLICK to navigate into them, analyse call hierarchies, etc.

AGAIN: I'M NOT LOOKING FOR SPEC JARS!!!!

like image 234
dexter meyers Avatar asked Jan 10 '13 18:01

dexter meyers


3 Answers

You can import the dependencies manually into your repository. I did it into ours (artifactory) and it's working.

See: https://access.redhat.com/site/documentation/en-US/JBoss_Enterprise_Application_Platform/6/html/Development_Guide/Install_the_JBoss_Enterprise_Application_Platform_6_Maven_Repository_Locally.html

like image 178
Ronaldo Campos Avatar answered Oct 22 '22 12:10

Ronaldo Campos


I found a surprisingly simple solution my self: even though libs are managed via Maven, and a target runtime is disabled by default, you can still explicitly select a target runtime.

The libraries this target runtime puts on the classpath will now also be put on the classpath for the Maven project, in addition to those Maven already puts there. You can (manually) attach the source code to those libraries.

Once you're doing with debugging and stepping through the internals of your AS, you can simply remove the target runtime again.

An answer that tells how to do this purely via Maven and for JBoss EAP 6.0.1 (not JBoss AS 7.1.1 or 7.1.3) would still be welcome, so I won't accept my own answer ;)

like image 23
dexter meyers Avatar answered Oct 22 '22 13:10

dexter meyers


There is a nice explanation of the JBoss Maven repositories at: https://community.jboss.org/wiki/MavenRepository

I would guess the repository you need to use is: https://repository.jboss.org/nexus/content/groups/public-jboss/ it should contain all JBoss artifacts you're looking for.

Maybee the groupId/artifactId is not correct. There is a search feature for the repositories at: https://repository.jboss.org/nexus/index.html#welcome

I would recommend to not include the impl jars as you cannot deploy them anyway. So the spec jars should be ok:

<dependency>
    <groupId>org.jboss.spec</groupId>
    <artifactId>jboss-javaee-6.0</artifactId>
    <version>1.0.0.Final</version>
    <type>pom</type>
</dependency>

see: http://www.andygibson.net/blog/quickbyte/jboss-java-ee-6-spec-dependency-in-maven/

The gav for the JBoss server seem to change a lot. JBoss 7 can be found at:

<dependency>
  <groupId>org.jboss.as</groupId>
  <artifactId>jboss-as-ee</artifactId>
  <version>7.1.3.Final</version>
</dependency>
like image 20
wemu Avatar answered Oct 22 '22 12:10

wemu