当前位置: 首页 > 知识库问答 >
问题:

Maven build找不到本地openshift project repo中已安装的自定义jar

邵博艺
2023-03-14

当我试图构建我的项目(从Eclipse Openshift插件)时,我面临着一个问题。

但是,我仍然在从Eclipse提交和发布时得到一个错误。这是控制台的转储

Repository ssh://53211e7...50000f0@testapp0...312-systix.rhcloud.com/~/git/testapp0...312.git/

Stopping RockMongo cartridge
[Sun Mar 16 12:20:37 2014] [warn] module php5_module is already loaded, skipping
httpd (no pid file) not running
MongoDB already stopped
Stopping jbossas cartridge
Repairing links for 1 deployments
Building git ref 'master', commit bb2def3
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-install-plugin:2.3.1:install-file (default-cli) @ standalone-pom ---
[INFO] Installing /var/lib/openshift/app-root/runtime/repo/shared-helper-data-skychart-0.0.1-SNAPSHOT.jar to /var/lib/openshift/53211e...0f0/.m2/repository/com/systix/shared-helper-data-skychart/0.0.1-SNAPSHOT/shared-helper-data-skychart-0.0.1-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.331s
[INFO] Finished at: Sun Mar 16 12:20:48 EDT 2014
[INFO] Final Memory: 4M/78M
[INFO] ------------------------------------------------------------------------
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-install-plugin:2.3.1:install-file (default-cli) @ standalone-pom ---
[INFO] Installing /var/lib/openshift/app-root/runtime/repo/shared-models-skychart-0.0.1-SNAPSHOT.jar to /var/lib/openshift/5321......00f0/.m2/repository/com/systix/shared-models-skychart/0.0.1-SNAPSHOT/shared-models-skychart-0.0.1-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.723s
[INFO] Finished at: Sun Mar 16 12:20:53 EDT 2014
[INFO] Final Memory: 4M/78M
[INFO] ------------------------------------------------------------------------
Found pom.xml... attempting to build with 'mvn -e clean package -Popenshift -DskipTests'
Apache Maven 3.0.3 (r1075437; 2011-06-20 13:22:37-0400)
Maven home: /etc/alternatives/maven-3.0
Java version: 1.7.0_51, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.51/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "2.6.32-431.5.1.el6oso.bz844450.x86_64", arch: "i386", family: "unix"
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building testapp0...312 1.0
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.134s
[INFO] Finished at: Sun Mar 16 12:21:04 EDT 2014
[INFO] Final Memory: 5M/111M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project testapp0...0312: Could not resolve dependencies for project testapp0...0312:testapp0...312:war:1.0: Could not find artifact com.systix:shared-helper-data-skychart:jar:0.0.1-SNAPSHOT -> [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
An error occurred executing 'gear postreceive' (exit code: 1)
Error message: CLIENT_ERROR: Failed to execute: 'control build' for /var/lib/openshift/5321...00f0/jbossas

For more details about the problem, try running the command again with the '--trace' option.

回顾上面的内容,maven似乎能够成功地将依赖项JAR添加到本地repo中,但项目的构建似乎没有。

UPDATE:包括我标记为安装在pre_build文件中的两个库中的pom.xml。这两个JAR都是构建的,包含在openshift git repo中,并在pre_build脚本中引用,该脚本将安装在openshift的maven repo中(结尾包含pre_build脚本)

<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>com.systix</groupId>
  <artifactId>shared-helper-data-skychart</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>
  <build>
    <sourceDirectory>src</sourceDirectory>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <source>1.7</source>
          <target>1.7</target>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <dependencies>
    <dependency>
        <groupId>org.mongodb</groupId>
        <artifactId>mongo-java-driver</artifactId>
        <version>2.11.4</version>
    </dependency>
    <dependency>
        <groupId>com.systix</groupId>
        <artifactId>shared-models-skychart</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>org.mongodb.morphia</groupId>
        <artifactId>morphia</artifactId>
        <version>0.105</version>
    </dependency>
  </dependencies>
</project>
<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>com.systix</groupId>
  <artifactId>shared-models-skychart</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>
  <build>
    <sourceDirectory>src</sourceDirectory>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <source>1.7</source>
          <target>1.7</target>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <dependencies>
    <dependency>
        <groupId>org.mongodb.morphia</groupId>
        <artifactId>morphia</artifactId>
        <version>0.105</version>
    </dependency>
    <dependency>
        <groupId>org.jsoup</groupId>
        <artifactId>jsoup</artifactId>
        <version>1.7.3</version>
    </dependency>
    <dependency>
        <groupId>org.mongodb</groupId>
        <artifactId>mongo-java-driver</artifactId>
        <version>2.11.4</version>
    </dependency>
  </dependencies>
</project>

使用的pre_build脚本

mvn install:install-file -Dfile=../app-root/runtime/repo/shared-helper-data-skychart-0.0.1-SNAPSHOT.jar -DgroupId=com.systix -DartifactId=shared-helper-data-skychart -Dversion=0.0.1-SNAPSHOT -Dpackaging=jar
mvn install:install-file -Dfile=../app-root/runtime/repo/shared-models-skychart-0.0.1-SNAPSHOT.jar -DgroupId=com.systix -DartifactId=shared-models-skychart -Dversion=0.0.1-SNAPSHOT -Dpackaging=jar

更新2:另外,上面的pom.xml是我的项目代码文件中的内容。但是,当我ssh intoopenshift服务器并查看本地maven repo时,下面是我所看到的pom.xml

cat ./.m2/repository/com/systix/shared-helper-data-skychart/0.0.1-SNAPSHOT/shared-helper-data-skychart-0.0.1-SNAPSHOT.pom
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.systix</groupId>
  <artifactId>shared-helper-data-skychart</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <description>POM was created from install:install-file</description>
</project>

共有1个答案

陶英达
2023-03-14

这是对我有效的:

  1. 我通过SSH连接到OpenShift,如下所述。
  2. 在那里,我发现在OpenShift maven repo中(~/.m2/repository/下)没有正确安装jar。在依赖项目录中有*.jar.lastUpdated文件,而不是实际的JAR.
  3. 我从maven repo中删除了有问题的依赖项的整个目录(手动)
  4. 在pre_build操作钩子中,我将mvn install:install-dfile路径更改为jar的绝对路径(例如/var/lib/openshift/___your__id__here___/app-root/runtime/repo/dependencyfile.jar
  5. 我推入了我的本地更改(在第4点中更改了预构建操作钩子。)git回购。现在一切都很好:)
 类似资料:
  • 错误: 回溯(最近一次调用):文件“./video_qt.py”,第8行,从PyQt5导入QtWidgets,QtCore importerror:/usr/lib/x86_64-linux-gnu/libqt5gui.so.5:找到版本`qt_5'not>(由/usr/local/lib/python3.5/dist-packages/PyQt5/QtWidgets.so所需) 但它就在那里:

  • 它找不到我添加到库中的费率栏库。 下面是我如何将我的库添加到应用程序中的 根级文件 依赖关系{...实现“xxx.xxx.xxxx:xxxx:1.0.6”...}

  • 问题内容: 我试图用cmake建立一个项目。这个项目正在使用Java等。问题是在代码处 我收到以下错误: 虽然 输出 怎么会?该错误的原因是什么? 问题答案: 如果您使用的是Linux操作系统,则必须将Java home设置为export

  • 我正在编写一个自定义Gradle插件来为所有项目添加公共资源。例如,所有微服务都使用SpringBoot web、sleuth和其他常见的依赖项。 因此,决定将创建一个独立的项目,并将插件导出为jar,然后将插件应用于其他项目。

  • 所以,我已经破坏了我的本地安装后安装瞬间插件。这个Momento插件 安装完成后,当我将命令放入正在运行的项目时,控制台返回的结果是: 无法确定“@Angular/CLI”的版本。这可能意味着您的本地安装已损坏。请重新安装您的软件包。 还有,尝试用git重新签出,但什么也没有。 该项目诞生于Angular 7 with Material。怎么解决这个问题?

  • 所以,我已经打破了我的本地安装后安装瞬间插件。这个Momento插件 安装完成后,当我将命令放入运行的project时,控制台返回的结果是: 无法确定“@Angulation/CLI”的版本。这可能意味着您的本地安装已损坏。请重新安装您的软件包。