[GRADLE-3140] Gradle doesn't correctly resolve POM dependency declarations with type ejb-client Created: 25/Jul/14  Updated: 25/Jul/14  Resolved: 25/Jul/14

Status: Resolved
Project: Gradle
Affects Version/s: 2.0
Fix Version/s: 2.1-rc-1

Type: Bug
Reporter: Gradle Forums Assignee: Benjamin Muschko
Resolution: Fixed Votes: 0


 Description   

We are in the process of migrating an application from Maven to Gradle. Our project depends on other libraries from within our company, which specify their dependency as type "ejb-client" from Maven. When attempting to resolve the dependency, it seems to resolves it as "<groupId>.<artifactId><version>.ejb-client", instead of "<groupId>.<artifactId><version>-client.jar". Am I missing something? Is it a decision to not support EJB clients? Is it something that was just missed? Is there a suggested way to get around it?

I notice that there is not really any documentation on EJBs with Gradle. Is there something on the roadmap to do something more with them, like being able to create client jars and publish them to a Maven repository?



 Comments   
Comment by Gradle Forums [ 25/Jul/14 ]

I assume you are trying to resolve a dependency with a classifier? For more information see the section [1]"50.4.1.3. Classifiers" in the Gradle user guide.
----------------------------------------------------------------------------------------
[1] http://www.gradle.org/docs/current/userguide/userguide_single.html#dependency_management

Comment by Gradle Forums [ 25/Jul/14 ]

Benjamin,

Thanks for the reply, but no. I think I need to clarify. I have a dependency that has a transitive dependency that is of type ["ejb-client"] ([1]http://maven.apache.org/plugins/maven...).

This is our first Gradle project at our company, so everything we are referencing outside of our project is Maven and uses things like ejb-clients.

Chris
----------------------------------------------------------------------------------------
[1] http://maven.apache.org/plugins/maven-ejb-plugin/examples/ejb-client-dependency.html

Comment by Gradle Forums [ 25/Jul/14 ]

I don't know about Benjamin, but I'm wondering what exactly you mean by "type". I made the same assumption Benjamin made, that you were talking about classifiers.

How about you show us some script and structure? We can't see enough to help you.

Comment by Gradle Forums [ 25/Jul/14 ]

So, within Maven, a dependency can have a type, which corresponds to the artifact's packaging type ([Maven doc] ([1]http://maven.apache.org/pom.html#Depe...)). The default for that type is a jar, but you can have things like ejb, war, or ear. With EJBs, there is a special dependency type, ejb-client ([Maven doc] ([2]http://maven.apache.org/plugins/maven...)). An ejb-client artifact should really have the EJB interface and other classes needed by that interface. And, you're right, based on the way I described it, in the Maven repository it looks just like a classifier. However, in the Maven POM, an ejb-client dependency would look like:

<dependency>
<groupId>com.example</groupId>
<artifactId>ejb-project</artifactId>
<version>1.0</version>
<type>ejb-client</type>
</dependency>

So, like I said, I'm referencing an existing Maven project from our repository (meaning I can't really change the project POM) that has a transitive dependency on an ejb-client, like above, and Gradle is not liking it. Using the above example, I'm getting an error like:

  • What went wrong:
    Could not resolve all dependencies for configuration ':common:compile'.
    > Artifact 'com.example:ejb-project:1.0:ejb-project.ejb-client' not found.

It seems that Gradle is taking the Maven dependency type and trying to use it as the suffix for the artifact.
----------------------------------------------------------------------------------------
[1] http://maven.apache.org/pom.html#Dependencies
[2] http://maven.apache.org/plugins/maven-ejb-plugin/examples/ejb-client-dependency.html

Comment by Gradle Forums [ 25/Jul/14 ]

Thanks for clarifying. I had a quick look at the parsing code and it looks like the type `ejb-client` is not handled correctly. I opened an issue.

Generated at Wed Jun 30 12:41:02 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.