我正在使用未连接到互联网的Linux(RHEL)盒子。我目前从maven-apache download page获得了“apache-maven-3.2.3-bin.tar.gz”。
当我在终端中运行“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]
(我正在删除多余的信息。如果你想让我添加标志-X或-e请我这样做,我会发布结果。我认为它们不会有用。)< / p>
我按照下载页面上的说明配置“基于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>
答案 0 :(得分:0)
要与Maven脱机工作,您需要一个具有所有所需工件的本地Maven存储库。当您在没有--offline
开关的情况下进行构建时,Maven会自动下载它们。
如果您的计算机无法访问Internet,您仍可以通过以下方式构建项目:
~/.m2/repository/
从在线计算机复制到离线计算机。--offline
。