Frage

I am trying to exclude a single library .JAR file from my EAR that is being built via Maven, as this library is included as a JBoss EAP module. I've followed the instructions in the documentation, but I always see this library included anyway. Here's what the relevant pom.xml section looks like:

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-ear-plugin</artifactId>
                <version>2.9</version>
                <configuration>
                    <!-- Tell Maven we are using Java EE 6 -->
                    <version>6</version>
                    <finalName>MenuProject</finalName>

                    <!-- Use Java EE ear libraries as needed. Java EE ear libraries are 
                        in easy way to package any libraries needed in the ear, and automatically 
                        have any modules (EJB-JARs and WARs) use them -->
                    <defaultLibBundleDir>lib</defaultLibBundleDir>
                    <packagingExcludes>**/postgresql*.jar</packagingExcludes>

                    <modules>
                        <!-- Register our War as a web module, and set the context root -->
                        <webModule>

...

As you see, I'm trying to exclude the postgresql*.jar file from being included in my EAR file. But, when I do a build I still see it.

Am I misunderstanding this functionality? Or am I doing it wrong? Any advice?

UPDATE: I should add, this library is added as a dependency for another library that my app depends on. That is why it is being introduced in the first place. I do not need it included in the EAR, as it is available as a JBoss EAP module.

War es hilfreich?

Lösung

Wrap your dependency type in a project object model pom as a type:

<dependency>
        <groupId>${project.that.has.postgres.as.dependency.groupId}</groupId>
        <artifactId>${project.that.has.postgres.as.dependency.artifactId}</artifactId>
        <version>${project.that.has.postgres.as.dependency.version}</version>
        <type>pom</type>
</dependency>
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top