简体   繁体   English

无法在全新的Maven安装中运行“ MVN验证清洁-脱机”

[英]Unable to run “mvn verify clean --offline” in a fresh Maven installation

I'm working on a linux (RHEL) box not connected to the internet. 我正在使用未连接到互联网的Linux(RHEL)盒。 I currently have the "apache-maven-3.2.3-bin.tar.gz" from the maven-apache download page . 我目前从maven-apache 下载页面获得“ apache-maven-3.2.3-bin.tar.gz”。

When I run "mvn verify clean --offline" in a terminal I get the following error: 在终端中运行“ mvn verify clean --offline”时,出现以下错误:

[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------------------------------------------
[INFO] Building ABC 2-SNAPSHOT
[INFO] ------------------------------------------------------
[WARNING] The POM for org.apache.maven.plugins:maven-=clean-plugin:jar:2.5 
          is missing, no dependency information available
[INFO] ------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------
[INFO] ................
[INFO] ------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its 
        dependencies could not be resolved: Could not find artifact 
        org.apache.maven.plugins:maven-clean-plugin:jar:2.5 -> [Help 1]
[ERROR] 
[ERROR] ................
[ERROR] 

(I'm removing extraneous info. If you want me to add the flag -X or -e ask me to do so and I'll post the results. I didn't think they'd be useful.) (我正在删除无关的信息。如果您希望我添加标志-X或-e,请我这样做,然后我将结果发布。我认为它们没有用。)

I followed the instructions on the download page to configure my box for "Unix-based Operating Systems" and converted my Eclipse 3.x RCP Application to a Maven Project, which created a pom.xml. 我按照下载页面上的指示信息来配置“基于Unix的操作系统”框,并将Eclipse 3.x RCP应用程序转换为Maven项目,该项目创建了pom.xml。

<project xmlns="http://maven.apache.org/POM/4.0.0" 
         xmlns:xsi="http://www.w3.oirg/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>data.git_repo.abc_repos</groupId>
  <artifactId>cem.abc</artifactId>
  <version>2-SNAPSHOT</version>
  <packaging>pom</packaging>
  <name>RDC</name>

  <properties>
    <tycho-version>0.21.0</tycho-version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEnconding>
  </properties>

  <profiles>
    <profile>
      <id>abc</id>
      <activation>
        <activeByDefault>true</activeByDefault>
        <property>
          <name>offline</name>
          <value>true</value>
        </property>
      </activation
    </profile>
  </profiles>

  <repositories>
    <repository>
      <id>central</id>
      <name>abc_repo</name>
      <layout>default</layout>
      <url>file:///data/git_repos/abc_repos/cem.abc</url>
      <releases>
        <enabled>false</enabled>
        <updatePolicy>never</updatePolicy>
      </releases>
    </repository>
  </repositories>

  <pluginRepositories>
    <pluginRepository>
      <id>central</id>
      <name>abc_repo</name>
      <layout>default</layout>
      <url>file:///data/git_repos/abc_repos/cem.abc</url>
      <snapshots>
        <enabled>true</enabled>
      <snapshots>
      <releases>
        <enabled>false</enabled>
        <updatePolicy>never</updatePolicy>
      </releases>
    <pluginRepository>    
  </pluginRepositories>

  <build>
    <sourceDirectory>src</sourceDirectory>
    <resources>
      <resources>
        <directory>src<directory>
      </resources>
    <resources>

    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.eclipse.tycho</groupId>
          <artifactId>target-platform-configuration</artifactId>
          <version>${tycho.version}</version>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
</project>

To work off-line with Maven, you need a local Maven repository which has all the needed artifacts. 要与Maven脱机工作,您需要一个具有所有必需工件的本地Maven存储库。 Maven automatically downloads them when you are building without the --offline switch. 在不使用--offline开关进行构建时,Maven会自动下载它们。

If you have a machine without Internet access, you can still build your project in the following way: 如果您有一台无法访问Internet的机器,您仍然可以通过以下方式构建项目:

  1. Build the on a machine with Internet access. 在可访问Internet的计算机上构建。
  2. Copy the local Maven repository ~/.m2/repository/ from the on-line machine to the off-line machine. 将本地Maven存储库~/.m2/repository/从在线计算机复制到离线计算机。
  3. Build the project with --offline . 使用--offline构建项目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM