Search code examples
javamaven-2maven-pluginexecutable-jarmaven-assembly-plugin

jar-with-dependencies not include external repositories


I'm trying to do an executable jar with my pom.xml, but the couchbase external repository is not included.

Everything is running ok in Eclipse. I have the couchbase client in the pom via:

<repositories>
    <repository>
        <id>couchbase</id>
        <name>Couchbase Maven Repository</name>
        <layout>default</layout>
        <url>http://files.couchbase.com/maven2/</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
</repositories>

...

<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-core</artifactId>
    <version>2.1.3</version>
</dependency>
<dependency>
    <groupId>couchbase</groupId>
    <artifactId>couchbase-client</artifactId>
    <version>1.1.7</version>
    <scope>provided</scope>
</dependency>

And the plugin:

   <plugin>
     <artifactId>maven-assembly-plugin</artifactId>
     <configuration>
       <archive>
         <manifest>
           <mainClass>fully.qualified.MainClass</mainClass>
         </manifest>
       </archive>
       <descriptorRefs>
         <descriptorRef>jar-with-dependencies</descriptorRef>
       </descriptorRefs>
     </configuration>
     <executions>
       <execution>
         <id>make-assembly</id> <!-- this is used for inheritance merges -->
         <phase>package</phase> <!-- bind to the packaging phase -->
         <goals>
           <goal>single</goal>
         </goals>
       </execution>
     </executions>
   </plugin>

But com.fasterxml.jackson.core is included in the jar, but com.couchbase.client... not

Thanks in advance.


Solution

  • Try to remove scope "provided" from couchbase-client dependency. This is an indication for assembly-plugin not to include this dependency cause it will be provided at runtime anyway