ali akbar azizkhani
ali akbar azizkhani

Reputation: 2289

merge jar using maven assembly without dependencies and overlay reources

I want to merge two jar project and overlay some resource in that .i have project A that have some other dependency and project type is jar . another project B depend to project a . i want to merge project A,B but i do not need fat jar for all dependency from project A.when i merge resource in project a and b i want prefer resource in project b that have same package in project a ,

my project structure is like this

 project A (depend to x.jar and y.jar)
     resources
       meta-inf
           resources
               edit.jsp
               index.jsp


project B 
  resources
       meta-inf
           resources
               index.jsp

i want merged jar structure will be like this

 project.jar 
  resources
       meta-inf
           resources
               edit.jsp
               index.jsp(from projectB)

how can i do it? i google it and find some result that say maven assembly and maven shade can do it . but i can not do that .

Upvotes: 0

Views: 316

Answers (1)

ali akbar azizkhani
ali akbar azizkhani

Reputation: 2289

after search i found that maven assembly plugin have dependencySets configuration that can include dependency to it .when add include in assembly.xml solve problem

 <dependencySets>
    <dependencySet>
        <outputDirectory>/</outputDirectory>
        <unpack>true</unpack>
        <includes>
            <include>project:A:jar</include>
        </includes>
    </dependencySet>
</dependencySets>

Upvotes: 1

Related Questions