[jboss-jira] [JBoss JIRA] (DROOLS-3277) KieScanner in Scala fat-jar application does not work due to Plexus configuration

Michael Reynolds (Jira) issues at jboss.org
Wed Nov 7 16:43:00 EST 2018


    [ https://issues.jboss.org/browse/DROOLS-3277?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13658493#comment-13658493 ] 

Michael Reynolds edited comment on DROOLS-3277 at 11/7/18 4:42 PM:
-------------------------------------------------------------------

To make this work in my SBT build, I had to do the following:
# Make META-INF/sisu/javax.named.Inject a 'concat' merge strategy
# Manually concat all of the META-INF/plexus/components.xml files into a "master" file and then choose that file as the one included in the fat-jar.

My SBT assembly configuration now looks like this. The attached components.xml file is in my project under src/main/resources/META-INF/plexus/components.xml.

{code:scala}
assemblyMergeStrategy in assembly := {
    case PathList( "META-INF", "MANIFEST.MF" ) => MergeStrategy.discard
    case PathList( "reference.conf" ) => MergeStrategy.concat
    case PathList( "META-INF", "kie.conf" ) => MergeStrategy.concat
    case PathList( "META-INF", "sisu", "javax.inject.Named" ) => MergeStrategy.concat
    case PathList( "META-INF", "plexus", "components.xml" ) => MergeStrategy.first
    case x => MergeStrategy.last
}
{code}



was (Author: reynoldsm88):
To make this work in my SBT build, I had to do the following:
# Make META-INF/sisu/javax.named.Inject a 'concat' merge stratedgy
# Manually concat all of the META-INF/plexus/components.xml files into a "master" file and then choose that file as the one included in the fat-jar.

My SBT assembly configuration now looks like this. The attached components.xml file is in my project under src/main/resources/META-INF/plexus/components.xml.

{code:scala}
assemblyMergeStrategy in assembly := {
    case PathList( "META-INF", "MANIFEST.MF" ) => MergeStrategy.discard
    case PathList( "reference.conf" ) => MergeStrategy.concat
    case PathList( "META-INF", "kie.conf" ) => MergeStrategy.concat
    case PathList( "META-INF", "sisu", "javax.inject.Named" ) => MergeStrategy.concat
    case PathList( "META-INF", "plexus", "components.xml" ) => MergeStrategy.first
    case x => MergeStrategy.last
}
{code}


> KieScanner in Scala fat-jar application does not work due to Plexus configuration
> ---------------------------------------------------------------------------------
>
>                 Key: DROOLS-3277
>                 URL: https://issues.jboss.org/browse/DROOLS-3277
>             Project: Drools
>          Issue Type: Feature Request
>          Components: core engine
>    Affects Versions: 7.13.0.Final
>            Reporter: Michael Reynolds
>            Assignee: Mario Fusco
>            Priority: Major
>         Attachments: components.xml, out.log
>
>
> The configuration required for all the KIE related components wired together with Sisu and in Plexus is spread out among many files with the same name/location in various library jars.
> The SBT assembly plugin is the standard for building a Scala fat-jar application. When it multiple versions of the same file when squashing the jars together it attempts to apply a merge strategy to them. For the Sisu configuration, it is simple enough to apply a "concat" merge strategy. However, the META-INF/plexus/components.xml cannot be automatically merged. Unless all the elements are present, various component lookups will fail when using the KieScanner.
> I've provided the following attachments related to this case:
> ||File||Description||
> |out.log|Output of starting the fat-jar application without properly merging the Sisu and Plexus configuration files|
> |components.xml|The merged components.xml file I created that resolves this issue.|



--
This message was sent by Atlassian Jira
(v7.12.1#712002)


More information about the jboss-jira mailing list