[
https://jira.codehaus.org/browse/MEAR-167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=335774#comment-335774
]
Anton Shaykin commented on MEAR-167:
------------------------------------
@Robert Scholte, You're welcome. Thanks for the fix! When could we expect the
new release of maven-ear-plugin?
> Classes from different modules with the same artifactId are merged when
> skinnyWars set to TRUE
> ----------------------------------------------------------------------------------------------
>
> Key: MEAR-167
> URL: https://jira.codehaus.org/browse/MEAR-167
> Project: Maven Ear Plugin
> Issue Type: Bug
> Affects Versions: 2.8
> Reporter: Anton Shaykin
> Assignee: Robert Scholte
> Fix For: 2.9
>
> Attachments: example.zip
>
>
> When some modules, that are to be included in ear, have the same artifactId,
> classes from those modules get merged.
> Consider this project structure
> {noformat}
> .
> |-root
> |-app
> |--business
> |---service
> |--ejb
> |---service
> {noformat}
> In this example, there are 2 ejb modules main.root.business:service:jar and
> main.root.ejb:service:jar with artifactId 'service'.
> Project app has the following build configuration:
> {code:xml}
> <build>
> <plugins>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-ear-plugin</artifactId>
> <version>2.8</version>
> <configuration>
> <skinnyWars>true</skinnyWars>
> <modules>
> <ejbModule>
> <groupId>main.root.ejb</groupId>
> <artifactId>service</artifactId>
> <uri>service1.jar</uri>
> </ejbModule>
> <ejbModule>
>
> <groupId>main.root.business</groupId>
> <artifactId>service</artifactId>
> <uri>service2.jar</uri>
> </ejbModule>
> </modules>
> </configuration>
> </plugin>
> </plugins>
> </build>
> {code}
> When I run {{maven-ear-plugin:ear}} goal I get an ear with 2 ejb jars in it
> (service1.jar and service2.jar), but the second one contains classes from
> both modules.
> I did some code digging, and this is what I've found (EarMojo, line 684):
> {code}
> workDirectory =
> new File( new File( generatedDescriptorLocation, "temp"
> ), module.getArtifact().getArtifactId() );
> workDirectory.mkdirs();
> {code}
> So, basically, when skinnyWars set to TRUE, you create a temporary folder
> with the name based on artifactId. That's why the classes are merged in the
> second jar.
> As a solution, I'd suggest either randomize the directory name, or at least
> check for a directory existence and remove it recursively, if found.
> The example project is attached to this ticket.
>
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira