How to enable libraries / dependencies when creating a jar file?

I created a Confluence plugin (Java application) that has Maven in it and includes some dependencies in pom.xml as follows: (it needs to use the Google client library)

<dependencies>
    <dependency>
        <groupId>com.google.apis</groupId>
        <artifactId>google-api-services-calendar</artifactId>
        <version>v3-rev254-1.22.0</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>com.google.api-client</groupId>
        <artifactId>google-api-client</artifactId>
        <version>1.22.0</version>
        <scope>compile</scope>
    </dependency>

    ..... Skip .....

</dependencies>

I also downloaded the Google client library and created the "libs" folder on the "src / main / resources /" path in this maven project to store them and added them as banks in Eclipse as follows:

enter image description here

However, after executing "atlas-debug" to invoke the Confluence or "atlas-package" commands, the last exported jar file usually does not contain dependencies / libraries (I found this to match the file of the failed jar file, it is much smaller than successful).

jar , "atlas-debug" "atlas-package"?

+4
1

maven-assembly-plugin, . pom.xml:

<build>
...
    <plugins>
    ...
       <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.2.2</version>
                <executions>
                    <execution>
                        <id>assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <descriptorRefs>
                                <descriptorRef>jar-with-dependencies</descriptorRef>
                            </descriptorRefs>
                            <archive>
                            </archive>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
    ...
    </plugins>
...
</build>

, , <scope>provided</scope>, .

+1

Source: https://habr.com/ru/post/1686712/


All Articles