ArtifactDescriptorException: Failed to read artifact description **jar missing

本文介绍了解决Eclipsemaven中ArtifactDescriptorException错误的方法,通过在pom.xml文件中添加特定的仓库配置,可以避免读取artifact描述失败的问题,确保正确下载jar包。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Eclipse maven报错

ArtifactDescriptorException: Failed to read artifact description

**jar missing

解决方法:

pom.xml porject添加

<repositories>

    <repository>

      <snapshots>

        <enabled>false</enabled>

      </snapshots>

      <id>central</id>

      <name>Maven Repository Switchboard</name>

      <url>http://repo2.maven.org/maven2</url>

    </repository>

  </repositories>

效果:下载jar包,并不报错。

DESUtil.java:package com.source.root.tools.util; import java.io.IOException; import java.security.SecureRandom; import javax.crypto.Cipher; import javax.crypto.SecretKey; import javax.crypto.SecretKeyFactory; import javax.crypto.spec.DESKeySpec; import java.util.Base64; // import sun.misc.BASE64Decoder; // import sun.misc.BASE64Encoder; public class DESUtil { private final static String DES = "DES/CBC/PKCS5Padding"; private static final Base64.Encoder BASE64_ENCODER = Base64.getEncoder(); private static final Base64.Decoder BASE64_DECODER = Base64.getDecoder(); public static void main(String[] args) throws Exception { String data = "123456789"; String key = "jia%duo$"; System.err.println(encrypt(data, key)); System.err.println(decrypt(encrypt(data, key), key)); } /** * Description 根据键值进行加密 * * @param data * @param key * 加密键byte数组 * @return * @throws Exception */ public static String encrypt(String data, String key) throws Exception { byte[] bt = encrypt(data.getBytes(), key.getBytes()); return BASE64_ENCODER.encodeToString(bt); } /** * Description 根据键值进行解密 * * @param data * @param key * 加密键byte数组 * @return * @throws IOException * @throws Exception */ public static String decrypt(String data, String key) throws IOException, Exception { if (data == null) return null; byte[] buf = BASE64_DECODER.decode(data); byte[] bt = decrypt(buf, key.getBytes()); return new String(bt); } /** * Description 根据键值进行加密 * * @param data * @param key * 加密键byte数组 * @return * @throws Exception */ private static byte[] encrypt(byte[] data, byte[] key) throws Exception { // 生成一个可信任的随机数源 SecureRandom sr = new SecureRandom(); // 从原始密钥数据创建DESKeySpec对象 DESKeySpec dks = new DESKeySpec(key); // 创建一个密钥工厂,然后用它把DESKeySpec转换成SecretKey对象 SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES"); SecretKey securekey = keyFactory.generateSecret(dks); // Cipher对象实际完成加密操作 Cipher cipher = Cipher.getInstance("DES"); // 用密钥初始化Cipher对象 cipher.init(Cipher.ENCRYPT_MODE, securekey, sr); return cipher.doFinal(data); } /** * Description 根据键值进行解密 * * @param data * @param key * 加密键byte数组 * @return * @throws Exception */ private static byte[] decrypt(byte[] data, byte[] key) throws Exception { // 生成一个可信任的随机数源 SecureRandom sr = new SecureRandom(); // 从原始密钥数据创建DESKeySpec对象 DESKeySpec dks = new DESKeySpec(key); // 创建一个密钥工厂,然后用它把DESKeySpec转换成SecretKey对象 SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES"); SecretKey securekey = keyFactory.generateSecret(dks); // Cipher对象实际完成解密操作 Cipher cipher = Cipher.getInstance("DES"); // 用密钥初始化Cipher对象 cipher.init(Cipher.DECRYPT_MODE, securekey, sr); return cipher.doFinal(data); } } pom.xml:<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>jdwlw</groupId> <artifactId>jdwlw</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>war</packaging> <name>maven Maven Webapp</name> <url>http://maven.apache.org</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>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.1.0</version> </dependency> --> <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.5</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>4.1.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>4.1.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>4.1.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-beans</artifactId> <version>4.1.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aop</artifactId> <version>4.1.6.RELEASE</version> </dependency> <!-- https://mvnrepository.com/artifact/org.ksoap2/ksoap2 --> <!-- <dependency> <groupId>org.ksoap2</groupId> <artifactId>ksoap2</artifactId> <version>2.1.2</version> </dependency> --> <dependency> <groupId>com.google.code.ksoap2-android</groupId> <artifactId>ksoap2-android</artifactId> <version>3.6.4</version> </dependency> <dependency> <groupId>javax.xml.soap</groupId> <artifactId>javax.xml.soap-api</artifactId> <version>1.4.0</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-jdbc</artifactId> <version>4.1.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> <version>4.1.6.RELEASE</version> </dependency> <!-- <dependency> <groupId>org.springframework</groupId> <artifactId>spring-orm</artifactId> <version>4.1.6.RELEASE</version> </dependency> --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-orm</artifactId> <version>3.2.13.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context-support</artifactId> <version>3.2.2.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc-portlet</artifactId> <version>4.1.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-expression</artifactId> <version>4.1.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aspects</artifactId> <version>4.1.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-websocket</artifactId> <version>4.1.6.RELEASE</version> </dependency> <dependency> <groupId>quartz</groupId> <artifactId>quartz</artifactId> <version>1.5.2</version> </dependency> <dependency> <groupId>org.apache.ibatis</groupId> <artifactId>ibatis-sqlmap</artifactId> <version>2.3.4.726</version> </dependency> <!-- <dependency>--> <!-- <groupId>com.ibatis</groupId>--> <!-- <artifactId>ibatis2-sqlmap</artifactId>--> <!-- <version>2.1.7.597</version>--> <!-- </dependency>--> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.17</version> </dependency> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>2.4</version> </dependency> <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> <version>1.2</version> </dependency> <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.6</version> </dependency> <dependency> <groupId>commons-dbcp</groupId> <artifactId>commons-dbcp</artifactId> <version>1.4</version> </dependency> <dependency> <groupId>commons-pool</groupId> <artifactId>commons-pool</artifactId> <version>1.6</version> </dependency> <dependency> <groupId>commons-fileupload</groupId> <artifactId>commons-fileupload</artifactId> <version>1.3.1</version> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.35</version> </dependency> <dependency> <groupId>com.belerweb</groupId> <artifactId>pinyin4j</artifactId> <version>2.5.0</version> </dependency> <dependency> <groupId>jstl</groupId> <artifactId>jstl</artifactId> <version>1.2</version> </dependency> <dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <version>2.5</version> </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> <version>4.4.1</version> </dependency> <dependency> <groupId>javax.mail</groupId> <artifactId>mail</artifactId> <version>1.5.0-b01</version> </dependency> <!-- 激光消息推送Starts --> <dependency> <groupId>cn.jpush.api</groupId> <artifactId>jpush-client</artifactId> <version>3.1.3</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.7.5</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>1.7.5</version> </dependency> <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>17.0</version> </dependency> <dependency> <groupId>com.squareup.okhttp</groupId> <artifactId>mockwebserver</artifactId> <version>1.5.4</version> <scope>test</scope> </dependency> <!-- 激光消息推送END --> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>3.11</version> </dependency> <dependency> <groupId>net.sf.ehcache</groupId> <artifactId>ehcache</artifactId> <version>2.10.0</version> </dependency> <dependency> <groupId>javax.servlet.jsp</groupId> <artifactId>jsp-api</artifactId> <version>2.2</version> </dependency> <dependency> <groupId>com.lowagie</groupId> <artifactId>itext</artifactId> <version>2.1.7</version> </dependency> <!-- https://mvnrepository.com/artifact/commons-net/commons-net --> <dependency> <groupId>commons-net</groupId> <artifactId>commons-net</artifactId> <version>3.3</version> </dependency> <!-- https://mvnrepository.com/artifact/com.mchange/c3p0 --> <dependency> <groupId>com.mchange</groupId> <artifactId>c3p0</artifactId> <version>0.9.5.2</version> </dependency> <!-- https://mvnrepository.com/artifact/org.apache.ws.commons.axiom/axiom-api --> <dependency> <groupId>org.apache.ws.commons.axiom</groupId> <artifactId>axiom-api</artifactId> <version>1.2.13</version> </dependency> <!-- https://mvnrepository.com/artifact/dom4j/dom4j --> <dependency> <groupId>dom4j</groupId> <artifactId>dom4j</artifactId> <version>1.6.1</version> </dependency> <!-- https://mvnrepository.com/artifact/org.apache.axis/axis --> <dependency> <groupId>org.apache.axis</groupId> <artifactId>axis</artifactId> <version>1.4</version> </dependency> <!-- https://mvnrepository.com/artifact/javax.xml.rpc/javax.xml.rpc-api --> <dependency> <groupId>javax.xml.rpc</groupId> <artifactId>javax.xml.rpc-api</artifactId> <version>1.1.1</version> </dependency> <!-- https://mvnrepository.com/artifact/org.apache.axis2/axis2 --> <dependency> <groupId>org.apache.axis2</groupId> <artifactId>axis2</artifactId> <version>1.7.6</version> <type>pom</type> </dependency> <!-- https://mvnrepository.com/artifact/org.apache.axis2/axis2-adb --> <dependency> <groupId>org.apache.axis2</groupId> <artifactId>axis2-adb</artifactId> <version>1.7.6</version> </dependency> <!-- https://mvnrepository.com/artifact/soap/soap --> <dependency> <groupId>soap</groupId> <artifactId>soap</artifactId> <version>2.3</version> </dependency> <!-- https://mvnrepository.com/artifact/commons-httpclient/commons-httpclient --> <dependency> <groupId>commons-httpclient</groupId> <artifactId>commons-httpclient</artifactId> <version>3.1</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.9.10.4</version> </dependency> <dependency> <groupId>org.eclipse.paho</groupId> <artifactId>org.eclipse.paho.client.mqttv3</artifactId> <version>1.2.0</version> </dependency> <dependency> <groupId>cn.hutool</groupId> <artifactId>hutool-all</artifactId> <version>5.7.2</version> </dependency> </dependencies> <build> <finalName>jdwlw</finalName> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.8</source> <target>1.8</target> <encoding>utf-8</encoding> <compilerArguments> <extdirs>${project.basedir}/src/main/webapp/WEB-INF/lib</extdirs> </compilerArguments> </configuration> </plugin> </plugins> <resources> <resource> <directory>src/main/resources</directory> <includes> <include>**/*.properties</include> <include>**/*.xml</include> </includes> <filtering>false</filtering> </resource> <resource> <directory>src/main/java</directory> <includes> <include>**/*.properties</include> <include>**/*.xml</include> </includes> <filtering>false</filtering> </resource> </resources> </build> </project> 依据上述代码解决报错:D:\biancheng\yf服务器代码\jdwlw>mvn clean package [INFO] Scanning for projects... [WARNING] [WARNING] Some problems were encountered while building the effective model for jdwlw:jdwlw:war:0.0.1-SNAPSHOT [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 359, column 12 [WARNING] [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. [WARNING] [WARNING] For this reason, future Maven versions might no longer support building such malformed projects. [WARNING] [INFO] [INFO] ----------------------------< jdwlw:jdwlw >----------------------------- [INFO] Building maven Maven Webapp 0.0.1-SNAPSHOT [INFO] from pom.xml [INFO] --------------------------------[ war ]--------------------------------- Downloading from central: https://repo.maven.apache.org/maven2/com/google/code/ksoap2-android/ksoap2-android/3.6.4/ksoap2-android-3.6.4.pom [WARNING] The POM for com.google.code.ksoap2-android:ksoap2-android:jar:3.6.4 is missing, no dependency information available Downloading from central: https://repo.maven.apache.org/maven2/com/google/code/ksoap2-android/ksoap2-android/3.6.4/ksoap2-android-3.6.4.jar [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3.187 s [INFO] Finished at: 2025-06-30T19:08:28+08:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal on project jdwlw: Could not resolve dependencies for project jdwlw:jdwlw:war:0.0.1-SNAPSHOT: Could not find artifact com.google.code.ksoap2-android:ksoap2-android:jar:3.6.4 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
最新发布
07-01
<think>好的,我现在需要帮助用户解决Maven构建时出现的依赖解析错误。用户遇到的错误信息是找不到`com.huawei.welink:welink-parent:pom:3.0.0-SNAPSHOT`这个artifact。首先,我得分析可能的原因,然后一步步指导用户解决。 首先,用户的问题可能出在几个方面:网络问题、仓库配置、依赖版本不存在,或者需要认证的私有仓库。根据错误信息,Maven在尝试下载父POM时失败,这说明父项目可能位于某个特定的仓库,而Maven无法访问。 首先,我应该检查用户是否配置了正确的镜像仓库。用户之前询问过mirror settings.xml的配置,可能已经设置了镜像,但可能没有包含华为的仓库。例如,华为的Welink SDK可能不在Maven中央仓库,需要配置华为的私有仓库地址。这时候需要用户确认是否在pom.xml或settings.xml中添加了对应的仓库配置。 其次,SNAPSHOT版本通常存在于快照仓库中,而默认的镜像可能没有覆盖到这些仓库。用户可能需要显式地在项目的pom.xml中添加华为的仓库URL,或者确保settings.xml中的镜像配置正确匹配了该仓库。另外,SNAPSHOT版本可能需要启用更新策略,比如设置为always,以便Maven总是检查最新版本。 另外,权限问题也可能导致无法下载依赖。如果华为的仓库需要认证,用户需要在settings.xml的<servers>部分添加相应的用户名和密码。这时候需要提醒用户检查是否需要认证,并正确配置server信息。 还有一种可能是该依赖确实不存在于配置的仓库中,或者版本号有误。用户需要确认依赖的版本是否存在,或者是否有拼写错误。访问仓库的URL直接查看是否存在对应的文件,可以手动下载试试。 此外,本地仓库可能损坏,可以建议用户删除对应的目录,重新下载。或者使用-U参数强制更新快照依赖。 最后,如果所有方法都无效,可能需要联系华为的支持团队,确认依赖的可用性和正确的仓库配置。 总结下来,我的回答需要分步骤引导用户检查仓库配置、添加正确的仓库地址、处理SNAPSHOT仓库的设置、检查认证信息,以及手动验证依赖是否存在。同时,提供具体的配置示例和命令,帮助用户一步步排查问题。</think>以下是针对该Maven依赖解析错误的**分步解决方案**: --- ### **一、错误原因定位** 错误核心信息: ``` Could not find artifact com.huawei.welink:welink-parent:pom:3.0.0-SNAPSHOT ``` 关键问题点: 1. **SNAPSHOT版本依赖**:`3.0.0-SNAPSHOT`属于**快照版本**,默认不会从中央仓库获取 2. **仓库配置缺失**:未正确配置华为Welink SDK的Maven仓库 3. **网络/权限问题**:目标仓库不可达或需要认证 --- ### **二、解决方案步骤** #### **步骤1:添加华为仓库配置** 在项目的`pom.xml`或全局`settings.xml`中增加华为仓库: ```xml <!-- 方式1:项目pom.xml --> <repositories> <repository> <id>huawei-public</id> <name>Huawei Public Repository</name> <url>https://repo.huaweicloud.com/repository/maven/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> <!-- 必须启用SNAPSHOT --> <updatePolicy>always</updatePolicy> </snapshots> </repository> </repositories> <!-- 方式2:全局settings.xml镜像配置 --> <mirror> <id>huawei-mirror</id> <name>Huawei Mirror</name> <url>https://repo.huaweicloud.com/repository/maven/</url> <mirrorOf>central,huawei-public</mirrorOf> </mirror> ``` #### **步骤2:强制更新SNAPSHOT版本** 在命令中添加`-U`参数强制更新: ```bash mvn clean install -U ``` #### **步骤3:检查仓库连通性** 手动访问仓库验证文件是否存在: ``` 访问以下URL(替换实际group路径): https://repo.huaweicloud.com/repository/maven/com/huawei/welink/welink-parent/3.0.0-SNAPSHOT/ ``` 预期应看到`maven-metadata.xml`和具体版本目录 #### **步骤4:清理本地缓存** 删除本地Maven仓库中的残留文件: ```bash rm -rf ~/.m2/repository/com/huawei/welink/ ``` --- ### **三、高级排查方法** #### **1. 依赖树分析** 查看完整的依赖关系: ```bash mvn dependency:tree -Dverbose -Dincludes=com.huawei.welink ``` #### **2. 详细错误日志** 添加`-X`参数获取调试信息: ```bash mvn clean install -X | grep "welink-parent" ``` #### **3. 仓库优先级验证** 检查实际生效的仓库顺序: ```bash mvn help:effective-pom | grep -A 10 '<repositories>' ``` --- ### **四、常见问题补充** #### **场景1:企业内网私有仓库** 若依赖存放在私有仓库中: 1. 在`settings.xml`中添加仓库认证信息: ```xml <servers> <server> <id>huawei-private</id> <username>your_username</username> <password>{加密密码}</password> </server> </servers> ``` 2. 配置对应的镜像规则 #### **场景2:版本已过期** 确认华为官方文档中SDK的最新版本: ```xml <!-- 尝试改用正式版本 --> <dependency> <groupId>com.huawei.welink.sdk</groupId> <artifactId>welink-sdk-java</artifactId> <version>2.2.0</version> <!-- 替换SNAPSHOT版本 --> </dependency> ``` --- ### **五、最终验证** 成功构建的特征日志: ``` [INFO] Downloaded from huawei-public: https://repo.huaweicloud.com/repository/maven/com/huawei/welink/welink-parent/3.0.0-SNAPSHOT/welink-parent-3.0.0-20230715.063210-1.pom ``` 如果问题仍未解决,建议: 1. 检查华为开发者论坛是否有仓库变更公告 2. 尝试从华为官方SDK下载渠道获取离线包 3. 联系华为技术支持确认版本可用性
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值