You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Stephane Nicoll (JIRA)" <ji...@codehaus.org> on 2008/08/03 17:39:26 UTC

[jira] Closed: (MEAR-89) Problem, the ear can be buildt with two artifact in same version if a classifier is specified

     [ http://jira.codehaus.org/browse/MEAR-89?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stephane Nicoll closed MEAR-89.
-------------------------------

      Assignee: Stephane Nicoll
    Resolution: Won't Fix

What you're trying to do is wrong.

An artifact with a given classifier is a different artifact from a maven dependency point of view so it is perfectly normal that maven brings lib1.jar if the projects depends on it.

Handling classified deps is not an easy task but I had to do that at work and here's how I fixed the problem.

First, add a properties in your parent pom

<obfuscated>obf</obfuscated>

Now, *IN EACH DEPENDENCY* that can be obfuscated, declared it this way

<dependency>
  <groupId>foo</groupId>
  <artifactId>lib1</artifactId>
  <version>blablabal</version>
  <classifier>${obfuscated}</classifier>
</dependency>

If you want to work with the non obfuscated jar, you need to do mvn -Dobfuscated= package (empty string = no classifier, hence the main artifact)

There is no other clean way to do it. What you are doing is wrong so if you're relying on the patched version of the EAR plugin, you better have to clean your dependencies management instead.

> Problem, the ear can be buildt with two artifact in same version if a classifier is specified
> ---------------------------------------------------------------------------------------------
>
>                 Key: MEAR-89
>                 URL: http://jira.codehaus.org/browse/MEAR-89
>             Project: Maven 2.x Ear Plugin
>          Issue Type: Bug
>            Reporter: Nicolas Mercereau
>            Assignee: Stephane Nicoll
>         Attachments: patch_EAR_plugin_MEAR-89.txt
>
>
> For example :
> I have an ear with 2 dependencies
> EAR_EXAMPLE :
> -> lib1.jar:alpha
> -> lib2.jar:beta
> I use the bundleFinalName to rename the lib1.jar and lib2.jar in order not to have the version in the name of the jar in the ear buildt (eg : not to have lib1-alpha.jar). So i have an ear wich contains lib1.jar and lib2.jar.
> lib2 has a dependency to lib1
> lib2 :beta
> -> lib1:alpha
> And now i deploy the lib1 in version alpha with a new classifier "obf" (the repository has two jars, the one normal : lib1-alpha.jar and the one obfuscated : lib1-aplha-obf.jar).
> And i want to build an EAR with the classifier "obf" for lib1 and lib2 (without classifier for lib2).
> EAR_EXAMPLE :
> -> lib1.jar:alpha:classifier=obf
> -> lib2.jar:beta
> The problem is that in the EAR, i obtains :
> - lib1.jar (which is in fact : lib1-aplha-obf.jar)
> - lib2.jar
> - and lib1-alpha.jar (which i does not want)
> The file lib1-alpha.jar is get by the transitive dependencies of lib2.
> I think it is a bug because the EAR should not take the lib1-alpha.jar, because it has already include the lib1-aplha-obf.jar which corresponds to the same artifact in the same version.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira