maven尝试下载本地存在的jar

发布于 2024-11-02 16:56:13 字数 1139 浏览 2 评论 0 原文

我将一个 jar 下载到本地存储库,但每次我编译 netbeans 时都尝试下载它,为什么会发生这种情况,我尝试更改依赖范围,但我无法找到解决方案。这是我的依赖项,我也尝试提供,运行时... 正则表达式 正则表达式 1.2_01 编译

Netbeans 输出如下,我使用 netbeans 建议的 maven 命令将手动下载的 jregex jar 存储到我的本地存储库,并且我还安装了其他依赖的 jar 并存储了我的本地存储库。

[警告] 使用平台编码(实际上是 UTF-8)来复制过滤的资源,即构建依赖于平台! 复制3个资源 下载: http://repository.jboss.org/ maven2//jregex/jregex/1.2_01/jregex-1.2_01.pom 无法在存储库repository.jboss.org (http://repository.jboss.org/maven2/) 中找到资源“jregex:jregex:pom:1.2_01” 下载:http://download.java。净/maven/2//jregex/jregex/1.2_01/jregex-1.2_01.pom 无法在存储库 java.net (http://download.java.net/maven/2/) 中找到资源“jregex:jregex:pom:1.2_01” 下载: http://repo1.maven.org/maven2 /jregex/jregex/1.2_01/jregex-1.2_01.pom 无法在存储库中央(http://repo1.maven.org/maven2)中找到资源“jregex:jregex:pom:1.2_01”

I download a jar to my local reposotory but every times i compile netbeans try to download it why can be this happen i try to change dependecy scope but i couldnt figure out a solution.This is my dependency i also try provided ,runtime...

jregex
jregex
1.2_01
compile

Netbeans output as below and i use netbeans suggested maven command to store manualy downloaded jregex jar to my local repository and i also have other dependend jars instaled and stored my local repository .

[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
Copying 3 resources
Downloading: http://repository.jboss.org/maven2//jregex/jregex/1.2_01/jregex-1.2_01.pom
Unable to find resource 'jregex:jregex:pom:1.2_01' in repository repository.jboss.org (http://repository.jboss.org/maven2/)
Downloading: http://download.java.net/maven/2//jregex/jregex/1.2_01/jregex-1.2_01.pom
Unable to find resource 'jregex:jregex:pom:1.2_01' in repository java.net (http://download.java.net/maven/2/)
Downloading: http://repo1.maven.org/maven2/jregex/jregex/1.2_01/jregex-1.2_01.pom
Unable to find resource 'jregex:jregex:pom:1.2_01' in repository central (http://repo1.maven.org/maven2)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

蓝海似她心 2024-11-09 16:56:13

cd 到包含 jregex-1.2_01.jar 文件的目录并运行以下命令:

mvn install:install-file -DgroupId=jregex -DartifactId=jregex -Dversion=1.2_01 -Dpackaging=jar -Dfile=jregex-1.2_01.jar

这将根据您编写的依赖项将 jar 安装在本地存储库中,其中是(如果我理解正确的话):

    <dependency>
        <groupId>jregex</groupId>
        <artifactId>jregex</artifactId>
        <version>1.2_01</version>
    </dependency>

如果你想摆脱警告,你还可以添加

 <build>
     <plugins>
         <plugin>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-resources-plugin</artifactId>
             <configuration>
                 <encoding>UTF-8</encoding>
             </configuration>
         </plugin>
         // ...
     </plugins>
     // ...
</build>

更新:检查 POM 本身 (jregex-1.2_01.pom)确实位于您的本地存储库中。也许这是显而易见的,你已经做到了,但我没有主意了:)出于某种原因,可能是在那里找到了 jar,但 pom 却没有。如果不是这种情况,那么当 maven 运行时和从控制台安装 jar 时,本地存储库之间会存在某种不匹配,但我不知道如何实现。

cd to the directory containing your jregex-1.2_01.jar file and run the following:

mvn install:install-file -DgroupId=jregex -DartifactId=jregex -Dversion=1.2_01 -Dpackaging=jar -Dfile=jregex-1.2_01.jar

That will install the jar in your local repository as indicated by the dependency you wrote, which is (if I understood correctly):

    <dependency>
        <groupId>jregex</groupId>
        <artifactId>jregex</artifactId>
        <version>1.2_01</version>
    </dependency>

If you want to get rid of the warning, you can also add

 <build>
     <plugins>
         <plugin>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-resources-plugin</artifactId>
             <configuration>
                 <encoding>UTF-8</encoding>
             </configuration>
         </plugin>
         // ...
     </plugins>
     // ...
</build>

update: check that the POM itself (jregex-1.2_01.pom) is really on your local repository. Maybe this is obvious and you already did it but I'm out of ideas :) For some reason it could be that the jar is found there, but the pom is not. If this is not the case, you have some kind of mismatch between the local repository when maven runs and when you install the jar from console, but I can't figure out how.

蝶…霜飞 2024-11-09 16:56:13
  • 您的依赖项可能位于错误的目录中
  • 您的“settings.xml”文件可能指向不存在依赖项的本地路径。

如果您需要进一步的解释,您应该发布 pom.xml、settings.xml 的摘录以及依赖项的路径...

  • Your dependency may be in a wrong directory
  • Your "settings.xml" file may point to a local path where the dependency doesn't exist.

You should post an extract from your pom.xml, settings.xml and the path to the dependency if you want further explanations...

妄断弥空 2024-11-09 16:56:13

或者您的依赖项在远程存储库中没有 pom 文件,maven 会重新尝试下载它。

请尝试使用最近发布的 nb 7.0,它嵌入了最新的 maven 3.x 二进制文件。

or your dependency doesn't have a pom file in the remote repository and maven re-attempts to download it.

please try with recently released nb 7.0, it has the uptodate maven 3.x binaries embedded.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文