我在eclipse中创建了一个.jar文件。我想使用Maven创建一个.jar文件。以下是我最终的.jar文件中预期的内容。我有ConsumerForKafka.class和PropertyUtils.class的源代码。某些机构可以帮助我使用pm.xml文件吗?我已经创建了一个pom.xml文件,但不确定是否与eclipse创建的文件相同。我在pom.xml中使用了以下代码段来生成jarinjarloader.jar,但它抛出了依赖项错误:有人可以帮助我创建pom.xml来创建.jar文件,如下所示:
<dependency>
<groupId>org.raisercostin</groupId>
<artifactId>eclipse-jarinjarloader</artifactId>
<version>1.2</version>
</dependency>
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------< attwifi:netcoolConsumerKafka >--------------------
[INFO] Building netcoolConsumer 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from central: https://repo.maven.apache.org/maven2/org/raisercostin/eclipse-jarinjarloader/1.2/eclipse-jarinjarloader-1.2.pom
[WARNING] The POM for org.raisercostin:eclipse-jarinjarloader:jar:1.2 is missing, no dependency information available
Downloading from central: https://repo.maven.apache.org/maven2/org/raisercostin/eclipse-jarinjarloader/1.2/eclipse-jarinjarloader-1.2.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.159 s
[INFO] Finished at: 2019-04-08T03:45:41Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project netcoolConsumerKafka: Could not resolve dependencies for project attwifi:netcoolConsumerKafka:jar:0.0.1-SNAPSHOT: Could not find artifact org.raisercostin:eclipse-jarinjarloader:jar:1.2 in central (https://repo.maven.apache.org/maven2) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
org/
org/eclipse/
org/eclipse/jdt/
org/eclipse/jdt/internal/
org/eclipse/jdt/internal/jarinjarloader/
org/eclipse/jdt/internal/jarinjarloader/JIJConstants.class
org/eclipse/jdt/internal/jarinjarloader/JarRsrcLoader$ManifestInfo.class
org/eclipse/jdt/internal/jarinjarloader/JarRsrcLoader.class
org/eclipse/jdt/internal/jarinjarloader/RsrcURLConnection.class
org/eclipse/jdt/internal/jarinjarloader/RsrcURLStreamHandler.class
org/eclipse/jdt/internal/jarinjarloader/RsrcURLStreamHandlerFactory.class
com/
com/groups/
com/groups/ConsumerForKafka.class
com/groups/PropertyUtils.class
apache-log4j-1.2.15.jar
jline-0.9.94.jar
log4j-1.2.16.jar
netty-3.7.0.Final.jar
slf4j-api-1.6.1.jar
slf4j-log4j12-1.6.1.jar
zkclient-0.10.jar
zookeeper-3.4.8.jar
metrics-core-2.1.2.jar
kafka_2.10-0.8.0.jar
scala-library-2.10.3.jar
<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>
<groupId>attwifi</groupId>
<artifactId>netcoolConsumerKafka</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>netcoolConsumer</name>
<url>http://repo.spring.io/plugins-release/</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20180813</version>
</dependency>
<dependency>
<groupId>org.raisercostin</groupId>
<artifactId>eclipse-jarinjarloader</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
<dependency>
<groupId>jline</groupId>
<artifactId>jline</artifactId>
<version>0.9.94</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty</artifactId>
<version>3.7.0.Final</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.101tec</groupId>
<artifactId>zkclient</artifactId>
<version>0.10</version>
</dependency>
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<version>3.4.8</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka_2.10</artifactId>
<version>0.8.0</version>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.10.3</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<finalName>ConsumerKafka</finalName>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<appendAssemblyId>false</appendAssemblyId>
<archive>
<manifest>
<mainClass>com.groups.ConsumerForKafka</mainClass>
</manifest>
</archive>
</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>
</plugins>
</build>
</project>