Search code examples
eclipsemavenejbearjava-ee-7

How to add resource folder to the my EJB jar by maven


We have a resources folder in our EAR, this folder contains some image,xml and text files. I need to add this folder to our EJBs manifest classpath.

myEAR
|-> resources 
|     |-> myXml.xml
|     |-> mytext.txt
|->lib
|   |-> pojo1.jar
|   |-> pojo2.jar 
|->ejb.jar

currently, my maven ear plugin adds our *.jar to my EJB jar classpath, for example, our ejb.jar manifest look like blowing:

Class-Path: lib/pojo1.jar lib/pojo2.jar

but I need to add our "resources" folder to this classpath too:

Class-Path: resources lib/pojo1.jar lib/pojo2.jar 

Solution

  • Finally, I find a solution for that. we are adding the resources folder to the classpath by using tag in EJB module POM file:

            <plugin>
                <artifactId>maven-ejb-plugin</artifactId>
                <version>${version.ejb.plugin}</version>
                <configuration>
                    <ejbVersion>${version.ejbImpl}</ejbVersion>
                    <archive>
                        <manifestEntries>
                             <Class-Path>resources</Class-Path>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>