Question

I have a maven project B which is packaged as a war B.war and has a 'local' dependency A.jar. The pom for building A.jar has a dependency on restFB and it resolves properly while compiling.

     <dependency>
        <groupId>com.restfb</groupId>
        <artifactId>restfb</artifactId>
        <version>${com.restfb-version}</version>
    </dependency>

However when I package B.war, restFB's jar is not present in the WEB-INF/lib directory of B.war and execution throws NoClassDefFoundError. What is also baffling is that I find this happening only when I build it on an AWS Amazon Linux and not while building on Ubuntu. There are similar questions in SO which suggest adding

         <packaging>war</packaging>

which I already have but doesn't seem to solve the problem. Any ideas how to solve this?

Était-ce utile?

La solution

It should be simple to understand, that you might have invoke locally under Ubuntu

mvn install

for A. Therefore it is in the local .m2 repository.

Did AWS Amazon Linux also have this artifact in its repository? If not, copy it there and try to package again.

Also you explicitly include and exclude certain artifacts within the build configuration for maven-war-plugin

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top