eclipse中的maven web项目报错:org/codehaus/plexus/archiver/jar/JarArchiver

本文提供了解决Maven项目构建错误的两种方法:通过在pom.xml文件中指定maven-compiler-plugin插件的版本号,或者清除相关缓存并重启Eclipse。

Errors occurred during thebuild.

Errors running builder 'Maven Project Builder' on project'ebus.transaction'.

org/codehaus/plexus/archiver/jar/JarArchiver

两种方式参考:

第一种:在pom.xml文件里的maven-compiler-plugin插件里指定版本号

[html]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. <plugins>    
  2.         <plugin>    
  3.             <artifactId>maven-compiler-plugin</artifactId>    
  4.             <version>2.3.2</version>    
  5.             <configuration>    
  6.                 <source>1.6</source>    
  7.                 <target>1.6</target>    
  8.                 <encoding>UTF-8</encoding>    
  9.             </configuration>    
  10.         </plugin>    
  11.     </plugins>  
第二种:

(1)关闭eclipse

(2)将\.m2\repository\org\codehaus\plexus\plexus-archiver删掉只剩最新版本

(3)重启就可以了


[root@yfw ~]# cd /opt/openfire [root@yfw openfire]# cd ~/openfire-plugins/restapi-plugin [root@yfw restapi-plugin]# cat > src/main/java/com/example/restapi/RestApiPlugin.java << 'EOF' > package com.example.restapi; > > import org.jivesoftware.openfire.container.Plugin; > import org.jivesoftware.openfire.container.PluginManager; > import java.io.File; > > public class RestApiPlugin implements Plugin { > @Override > public void initializePlugin(PluginManager manager, File pluginDirectory) { > System.out.println("✅ REST API Plugin 已成功加载!"); > } > > @Override > public void destroyPlugin() { > System.out.println("🛑 REST API Plugin 已卸载。"); > } > } > EOF [root@yfw restapi-plugin]# ls -l src/main/java/com/example/restapi/RestApiPlugin.java -rw-r--r-- 1 root root 500 Oct 3 02:05 src/main/java/com/example/restapi/RestApiPlugin.java [root@yfw restapi-plugin]# cat src/main/java/com/example/restapi/RestApiPlugin.java package com.example.restapi; import org.jivesoftware.openfire.container.Plugin; import org.jivesoftware.openfire.container.PluginManager; import java.io.File; public class RestApiPlugin implements Plugin { @Override public void initializePlugin(PluginManager manager, File pluginDirectory) { System.out.println("✅ REST API Plugin 已成功加载!"); } @Override public void destroyPlugin() { System.out.println("🛑 REST API Plugin 已卸载。"); } } [root@yfw restapi-plugin]# mvn clean package [INFO] Scanning for projects... [INFO] [INFO] ------------< com.example.openfire.plugins:restapi-plugin >------------- [INFO] Building REST API Plugin 1.0.0-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ restapi-plugin --- [INFO] Deleting /root/openfire-plugins/restapi-plugin/target [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ restapi-plugin --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 1 resource [INFO] [INFO] --- maven-compiler-plugin:3.11.0:compile (default-compile) @ restapi-plugin --- [INFO] Changes detected - recompiling the module! :source [INFO] Compiling 1 source file with javac [debug target 11] to target/classes [WARNING] system modules path not set in conjunction with -source 11 [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ restapi-plugin --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory /root/openfire-plugins/restapi-plugin/src/test/resources [INFO] [INFO] --- maven-compiler-plugin:3.11.0:testCompile (default-testCompile) @ restapi-plugin --- [INFO] No sources to compile [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ restapi-plugin --- [INFO] No tests to run. [INFO] [INFO] --- maven-jar-plugin:3.3.0:jar (default-jar) @ restapi-plugin --- Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.3.0/plexus-utils-3.3.0.pom Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.3.0/plexus-utils-3.3.0.pom (5.2 kB at 1.7 kB/s) Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-archiver/3.6.0/maven-archiver-3.6.0.pom Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-archiver/3.6.0/maven-archiver-3.6.0.pom (3.9 kB at 8.3 kB/s) Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-io/3.4.0/plexus-io-3.4.0.pom Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-io/3.4.0/plexus-io-3.4.0.pom (6.0 kB at 12 kB/s) Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-archiver/4.4.0/plexus-archiver-4.4.0.pom Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-archiver/4.4.0/plexus-archiver-4.4.0.pom (6.3 kB at 13 kB/s) Downloading from central: https://repo.maven.apache.org/maven2/org/apache/commons/commons-compress/1.21/commons-compress-1.21.pom Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/commons/commons-compress/1.21/commons-compress-1.21.pom (20 kB at 38 kB/s) Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.4.2/plexus-utils-3.4.2.pom Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.4.2/plexus-utils-3.4.2.pom (8.2 kB at 17 kB/s) Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-archiver/3.6.0/maven-archiver-3.6.0.jar Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-io/3.4.0/plexus-io-3.4.0.jar Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-archiver/4.4.0/plexus-archiver-4.4.0.jar Downloading from central: https://repo.maven.apache.org/maven2/org/apache/commons/commons-compress/1.21/commons-compress-1.21.jar Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-interpolation/1.26/plexus-interpolation-1.26.jar Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-archiver/3.6.0/maven-archiver-3.6.0.jar (26 kB at 46 kB/s) Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.4.2/plexus-utils-3.4.2.jar Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-io/3.4.0/plexus-io-3.4.0.jar (79 kB at 68 kB/s) Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-interpolation/1.26/plexus-interpolation-1.26.jar (85 kB at 73 kB/s) Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-archiver/4.4.0/plexus-archiver-4.4.0.jar (211 kB at 159 kB/s) Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.4.2/plexus-utils-3.4.2.jar (267 kB at 191 kB/s) Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/commons/commons-compress/1.21/commons-compress-1.21.jar (1.0 MB at 556 kB/s) [INFO] Building jar: /root/openfire-plugins/restapi-plugin/target/restapi-plugin-assembly.jar [INFO] [INFO] --- maven-assembly-plugin:3.6.0:single (default) @ restapi-plugin --- Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-filtering/3.3.1/maven-filtering-3.3.1.pom Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-filtering/3.3.1/maven-filtering-3.3.1.pom (6.0 kB at 13 kB/s) Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-archiver/4.7.1/plexus-archiver-4.7.1.pom Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-archiver/4.7.1/plexus-archiver-4.7.1.pom (6.5 kB at 14 kB/s) Downloading from central: https://repo.maven.apache.org/maven2/com/github/luben/zstd-jni/1.5.5-2/zstd-jni-1.5.5-2.pom Downloaded from central: https://repo.maven.apache.org/maven2/com/github/luben/zstd-jni/1.5.5-2/zstd-jni-1.5.5-2.pom (1.9 kB at 3.8 kB/s) Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.5.1/plexus-utils-3.5.1.pom Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.5.1/plexus-utils-3.5.1.pom (8.8 kB at 17 kB/s) Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-filtering/3.3.1/maven-filtering-3.3.1.jar Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-io/3.4.1/plexus-io-3.4.1.jar Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-archiver/4.7.1/plexus-archiver-4.7.1.jar Downloading from central: https://repo.maven.apache.org/maven2/org/apache/commons/commons-compress/1.23.0/commons-compress-1.23.0.jar Downloading from central: https://repo.maven.apache.org/maven2/com/github/luben/zstd-jni/1.5.5-2/zstd-jni-1.5.5-2.jar Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-filtering/3.3.1/maven-filtering-3.3.1.jar (55 kB at 109 kB/s) Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.5.1/plexus-utils-3.5.1.jar Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-io/3.4.1/plexus-io-3.4.1.jar (79 kB at 150 kB/s) Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-archiver/4.7.1/plexus-archiver-4.7.1.jar (221 kB at 390 kB/s) Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.5.1/plexus-utils-3.5.1.jar (269 kB at 262 kB/s) Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/commons/commons-compress/1.23.0/commons-compress-1.23.0.jar (1.1 MB at 880 kB/s) Downloaded from central: https://repo.maven.apache.org/maven2/com/github/luben/zstd-jni/1.5.5-2/zstd-jni-1.5.5-2.jar (5.9 MB at 1.3 MB/s) [WARNING] Artifact: com.example.openfire.plugins:restapi-plugin:jar:1.0.0-SNAPSHOT references the same file as the assembly destination file. Moving it to a temporary location for inclusion. [INFO] Building jar: /root/openfire-plugins/restapi-plugin/target/restapi-plugin-assembly.jar [WARNING] Configuration option 'appendAssemblyId' is set to false. Instead of attaching the assembly file: /root/openfire-plugins/restapi-plugin/target/restapi-plugin-assembly.jar, it will become the file for main project artifact. NOTE: If multiple descriptors or descriptor-formats are provided for this project, the value of this file will be non-deterministic! [WARNING] Replacing pre-existing project main-artifact file: /root/openfire-plugins/restapi-plugin/target/archive-tmp/restapi-plugin-assembly.jar with assembly file: /root/openfire-plugins/restapi-plugin/target/restapi-plugin-assembly.jar [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 16.182 s [INFO] Finished at: 2025-10-03T02:07:06+08:00 [INFO] ------------------------------------------------------------------------ [root@yfw restapi-plugin]#
10-04
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值