You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何将JAR包上传至远程仓库并解决POM依赖缺失工件问题

Fixing the Artifact Missing Error & Properly Uploading JARs to Remote Maven Repository

Alright, let's sort out your artifact missing issue first, then cover the correct way to publish JARs to a remote Maven repository so this doesn't happen again.

Why You're Seeing the Artifact Missing Error

Manually creating the directory structure (jxl/jxl/1/jxl.jar) isn't enough for Maven to recognize the artifact. Maven requires additional metadata files alongside the JAR to validate its validity:

  • A corresponding pom.xml for the artifact
  • Checksum files (.md5, .sha1) for both the JAR and POM

Without these files, Maven can't confirm the artifact is legitimate, hence the missing error you're seeing.

Step 1: Correctly Upload Your JAR to the Remote Repository

The standard, reliable way to publish JARs to a remote Maven repo is using the deploy:deploy-file Maven command. This handles all directory structure creation, metadata generation, and upload automatically.

Run This Command

Replace /path/to/your/jxl.jar with the actual file path of your JAR on your local machine:

mvn deploy:deploy-file \
  -DgroupId=jxl \
  -DartifactId=jxl \
  -Dversion=1 \
  -Dpackaging=jar \
  -Dfile=/path/to/your/jxl.jar \
  -Durl=http://xx.yy.zz.ss/uirepo \
  -DrepositoryId=uirepo

Configure Repository Authentication (If Required)

If your remote repository requires login credentials, add this block to your settings.xml (usually located in ~/.m2/settings.xml or your Maven installation's conf/settings.xml):

<settings>
  <servers>
    <server>
      <id>uirepo</id>
      <username>your-repo-username</username>
      <password>your-repo-password</password>
    </server>
  </servers>
</settings>

Make sure the <id> here matches the repositoryId in your deploy command and your pom.xml's repository <id>.

Step 2: Verify Your pom.xml Configuration

Your current pom.xml setup looks correct, but let's double-check to be sure:

<repositories>
  <repository>
    <id>uirepo</id>
    <url>http://xx.yy.zz.ss/uirepo</url>
  </repository>
</repositories>
<dependencies>
  <dependency>
    <groupId>jxl</groupId>
    <artifactId>jxl</artifactId>
    <version>1</version>
  </dependency>
</dependencies>

The repository ID matches across configurations, and the dependency coordinates align with what you're uploading—this should work seamlessly once the artifact is properly deployed.

Alternative: Upload via Repository Management UI

If you're using a tool like Nexus, Artifactory, or Apache Archiva for your remote repo, you can also upload the JAR through their web interface:

  • Look for an "Upload" section in the tool's UI
  • Fill in the groupId, artifactId, version fields, then select your JAR file
  • The tool will auto-generate all required metadata and place the JAR in the correct directory structure

Final Steps to Resolve the Error

  1. Run the deploy:deploy-file command (or upload via UI) to publish the JAR correctly to your remote repo
  2. Refresh your Maven project (in IDEs like IntelliJ/Eclipse, use the "Reload All Maven Projects" option)
  3. Run mvn clean install to pull the dependency from the remote repository

This should fully resolve the artifact missing error.

内容的提问来源于stack exchange,提问作者k.rohit

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 07:12:36