6

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!!!!

Community
  • 1
  • 1
dexter meyers
  • 2,798
  • 2
  • 18
  • 22
  • 1
    Check out this very related question: http://stackoverflow.com/questions/9839689. And this guide which eases the pain (though not exactly what you are asking for): http://navinpeiris.com/2011/07/19/importing-jboss-7-dependencies-through-maven/. Also, wouldn't it be best practice to compile against the JBoss __specification libs__ rather than the concrete implementations? – ctrueden Jan 18 '13 at 19:28

6 Answers6

3

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

Ronaldo Campos
  • 361
  • 2
  • 13
  • Yes, I found that one and use if for source attachment, but what would the single root dependency in pom.xml be? It's great that the repo is there, but if I need to add every jar individually to the pom and then update it for each version of JBoss it's not really convenient either. – dexter meyers Jul 25 '13 at 10:14
2

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 ;)

dexter meyers
  • 2,798
  • 2
  • 18
  • 22
1

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>
wemu
  • 7,952
  • 4
  • 30
  • 59
  • >I would recommend to not include the impl jars as you cannot deploy them anyway. - I'm really sorry, but that's the entire point of my question :| – dexter meyers Feb 04 '13 at 17:13
  • well you can add the dependency with scope provided in case you want to cast something to a known type. But containers usually skip jars containing javax.* packages – wemu Feb 04 '13 at 17:39
  • In order to use the provided scope I do need to have the dependency in the first place. Note that I rarely, if ever, need to reference the container specific types in my code. It's 99.9% for the ability to step through (=debug) container code and look up/inspect container specific references. – dexter meyers Feb 05 '13 at 10:07
  • True. I would try to extract that information from the sources: https://github.com/jbossas/jboss-as - it must be in there somewhere. I would search the poms that have a spec dependency. One should be your entry point to the implementation. – wemu Feb 11 '13 at 10:21
0

Take a look here:

JBoss Enterprise Application Platform Component Details

And in my pom.xml I'm using this to get dependencies from Jboss EAP 6.0.1

<dependency>
    <groupId>org.jboss.spec</groupId>
    <artifactId>jboss-javaee-6.0</artifactId>
    <type>pom</type>                
    <scope>provided</scope>
    <version>3.0.2.Final</version>
</dependency>
delkant
  • 2,304
  • 1
  • 29
  • 28
  • Helpful, thanks! But still not that single Maven dependency corresponding to the entire server. – dexter meyers Feb 14 '14 at 13:41
  • just modified my answer, is it that what you needed? – delkant Feb 21 '14 at 21:11
  • Sorry, but it absolutely is so not what I'm searching for. Read the question: **I'M NOT LOOKING FOR SPEC JARS!!!!** ;) Thanks for the effort really, but I'm absolutely and utterly not looking for the spec jars. – dexter meyers Feb 24 '14 at 12:57
0

You can use Nexus or Git or Overlord to manage project artifacts in order to create a proxy virtual dependency, if i am not mistaken.

keydet
  • 1
  • No need to proxy or store anything, I just want *1* Maven dependency for the *implementation* code for a specific JBoss version, – dexter meyers Nov 05 '15 at 14:21
0

Runtime artifacts can be used:

<!-- https://mvnrepository.com/artifact/org.jboss.bom/eap-runtime-artifacts -->
<dependency>
    <groupId>org.jboss.bom</groupId>
    <artifactId>eap-runtime-artifacts</artifactId>
    <version>7.1.0.GA</version>
    <type>pom</type>
    <scope>import</scope>
</dependency>

See https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.1/html/development_guide/using_maven_with_eap#manage_project_dependencies

Lee He
  • 181
  • 12