libフォルダに依存するjarファイルを持つjarファイルを作成しました。作成したjarをライブラリとして使用しようとすると、「スレッド内の例外」メインの「java.lang.NoClassDefFoundError」のように表示されます。すべての必要な瓶を最終的な瓶に入れる方法は?
従属するjarを持つjarファイルを作成するのに助けてくれる人はいますか?
ありがとうございます。ここで
は私のpom.xmlです: `
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<properties>
<jclouds.version>1.9.2</jclouds.version>
</properties>
<groupId>org.apache.jclouds.examples</groupId>
<artifactId>openstack-examples</artifactId>
<version>1.0</version>
<build>
<plugins>
<!-- any other plugins -->
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.1</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<!-- this is used for inheritance merges -->
<phase>package</phase>
<!-- append to the packaging phase. -->
<goals>
<goal>attached</goal>
<!-- goals == mojos -->
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
これは私のjarファイル内のMANIFESTの内容です:あなたはmaven shade jarにを使用することができます
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Built-By: root
Created-By: Apache Maven 3.3.9
Build-Jdk: 1.8.0_25
Here I add the image for structure of my jar file.
mavenを使用していますか?それは非常に簡単です。 –
'lib'のjarファイルをクラスパスに入れる必要があります。 – Sanjeev
あなたはそれを見ることができます。 https://www.youtube.com/watch?v=BsndjGOc1w4 – Rafiq