Maven 找不到 codehaus 工件 org.codehaus:codehaus-parent
Maven failure to find codehaus artifact org.codehaus:codehaus-parent
所以 codehaus 关闭了(显然是在周末):https://www.codehaus.org/
现在这里说 "Maven: All repositories are mirrored into Central, and our Nexus is hosted by Sonatype"。如果我没看错,这意味着它应该继续工作(因为 Central 是默认存储库,我什至不应该做任何更改)。
然而,我遇到了一个 Maven 项目的问题,该项目曾经编译(关闭前),但现在失败了:
[INFO] Error building POM (may not be this project's POM).
Project ID: org.codehaus.groovy:groovy-eclipse-compiler:maven-plugin:2.9.1-01
Reason: Cannot find parent: org.codehaus:codehaus-parent for project: org.codehaus.groovy:groovy-eclipse-compiler:maven-plugin:2.9.1-01 for project org.codehaus.groovy:groovy-eclipse-compiler:maven-plugin:2.9.1-01
这是我的 pom.xml:
的精简版
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.hp</groupId>
<artifactId>device-state-service</artifactId>
<packaging>war</packaging>
<version>1.0.0</version>
<name>device-state-service</name>
<properties>
<spring.version>3.2.0.RELEASE</spring.version>
<groovy-all.version>2.3.7</groovy-all.version>
<spock-core.version>0.7-groovy-2.0</spock-core.version>
<lombok.version>1.12.2</lombok.version>
...
</properties>
<dependencies>
...
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>${groovy-all.version}</version>
</dependency>
...
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>
...
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>${spock-core.version}</version>
<scope>test</scope>
</dependency>
...
<dependency>
<groupId>org.codehaus.groovy.modules.http-builder</groupId>
<artifactId>http-builder</artifactId>
<version>0.7</version>
<scope>test</scope>
</dependency>
...
</dependencies>
<build>
<finalName>dss</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/resources</directory>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<compilerId>groovy-eclipse-compiler</compilerId>
<verbose>false</verbose>
<compilerArguments>
<javaAgentClass>lombok.core.Agent</javaAgentClass>
</compilerArguments>
<fork>true</fork>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-compiler</artifactId>
<version>2.9.1-01</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-batch</artifactId>
<version>2.3.7-01</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</dependency>
</dependencies>
</plugin>
...
</plugins>
</build>
<profiles>
<profile>
<id>dss</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>deliverable</name>
<value>dss</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<version>2.1-alpha-1</version>
<executions>
<execution>
<goals>
<goal>rpm</goal>
</goals>
</execution>
</executions>
<configuration>
...
<name>${deliverable}</name>
<projversion>${pom.version}</projversion>
<release>${BUILD_NUMBER}</release>
<description>Search: RPM package</description>
<mappings>
<mapping>
<directory>${tomcatInstallationDir}</directory>
<filemode>755</filemode>
<username>tomcat</username>
<groupname>tomcat</groupname>
<sources>
<source>
<location>../Tomcat/</location>
</source>
</sources>
</mapping>
<mapping>
<directory>${tomcatInstallationDir}/webapps</directory>
<filemode>755</filemode>
<username>tomcat</username>
<groupname>tomcat</groupname>
<sources>
<source>
<location>target/${deliverable}.war
</location>
<destination>${deliverable}.war</destination>
</source>
</sources>
</mapping>
</mappings>
<requires>
<require>palm-jre >= 1.6.0_27-fcs</require>
</requires>
<prefix>${tomcatInstallationDir}</prefix>
<preinstallScriptlet>
<scriptFile>../PlatformEngine/rpm_scripts/pre_install.sh</scriptFile>
<fileEncoding>utf-8</fileEncoding>
</preinstallScriptlet>
<postinstallScriptlet>
<scriptFile>../PlatformEngine/rpm_scripts/post_install.sh</scriptFile>
<fileEncoding>utf-8</fileEncoding>
</postinstallScriptlet>
<preremoveScriptlet>
<scriptFile>../PlatformEngine/rpm_scripts/pre_uninstall.sh</scriptFile>
<fileEncoding>utf-8</fileEncoding>
</preremoveScriptlet>
<postremoveScriptlet>
<scriptFile>../PlatformEngine/rpm_scripts/post_uninstall.sh</scriptFile>
<fileEncoding>utf-8</fileEncoding>
</postremoveScriptlet>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
现在,在我的 .m2 目录中,我为 groovy-all
项目找到了一个 pom/sha1 和一个 jar 文件。但是对于 groovy-eclipse-compiler
,我看到 pom/sha1, 但没有 jar 文件 。
我是不是做错了什么? Codehaus 迁移本身是否以某种方式搞砸了?或者(更糟)两者都有?
maven 工件已经在中央很长时间了,没有迁移可能会搞砸这些。
由于我不是行家专家,所以我只能告诉您我认为是原因的原因。查看 groovy-eclipse-compiler 版本 2.9.1-01 的 pom,我看到
<repositories>
<repository>
<id>codehaus.org</id>
<url>http://repository.codehaus.org</url>
</repository>
</repositories>
ans 我的假设是,这将导致 Maven 查找该存储库,该存储库不再存在。如果这是真的,那么我对解决方案的建议是手动安装工件(它们都在 Maven Central 上)或使用不同的工具,如 gradle(尽管这可能超出你的范围)到进行构建。
编辑:
有人告诉我,您可以更改 settings.xml 以使用如下模式修复存储库配置:
<repositories>
<repository>
<id>codehaus.org</id>
<url>http://nexus.codehaus.org/<some suburl></url>
</repository>
</repositories>
例如使用 http://mvnrepository.com/artifact 可能会起作用,但我还没有测试过。
您引用的工件:
org.codehaus.groovy:groovy-eclipse-compiler:maven-plugin:2.9.1-01
如果您的构建没有找到它,那么只是您的配置有误。 network/proxy 问题等(请参阅您的 settings.xml)您可以通过以下方式在 Maven 中心搜索此工件:http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.codehaus.groovy%22%20AND%20a%3A%22groovy-eclipse-compiler%22
除了添加补充存储库之外,这没有帮助。此外,像这样在 Maven pom 中添加默认值:
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/resources</directory>
</testResource>
</testResources>
也没有意义,因为这些是默认值。我也偶然发现你正在定义编码之类的东西:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
首先像这样定义插件的版本是好的(但你应该使用uptodate versions)但是你不应该在每个插件中定义编码。为此,存在 属性:
<project>
...
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
...
</project>
通过使用上面的代码,您不需要为每个插件提供编码,因为 maven-resources-plugin, maven-compiler-plugin 等插件定义了默认值。
关于 codehaus migration 的一句话。这意味着只有他们为开发人员提供的服务正在关闭,而不是已经属于 Maven Central 的内容。
我建议在您自己的基础架构中安装一个存储库管理器。
所以 codehaus 关闭了(显然是在周末):https://www.codehaus.org/
现在这里说 "Maven: All repositories are mirrored into Central, and our Nexus is hosted by Sonatype"。如果我没看错,这意味着它应该继续工作(因为 Central 是默认存储库,我什至不应该做任何更改)。
然而,我遇到了一个 Maven 项目的问题,该项目曾经编译(关闭前),但现在失败了:
[INFO] Error building POM (may not be this project's POM).
Project ID: org.codehaus.groovy:groovy-eclipse-compiler:maven-plugin:2.9.1-01
Reason: Cannot find parent: org.codehaus:codehaus-parent for project: org.codehaus.groovy:groovy-eclipse-compiler:maven-plugin:2.9.1-01 for project org.codehaus.groovy:groovy-eclipse-compiler:maven-plugin:2.9.1-01
这是我的 pom.xml:
的精简版<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.hp</groupId>
<artifactId>device-state-service</artifactId>
<packaging>war</packaging>
<version>1.0.0</version>
<name>device-state-service</name>
<properties>
<spring.version>3.2.0.RELEASE</spring.version>
<groovy-all.version>2.3.7</groovy-all.version>
<spock-core.version>0.7-groovy-2.0</spock-core.version>
<lombok.version>1.12.2</lombok.version>
...
</properties>
<dependencies>
...
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>${groovy-all.version}</version>
</dependency>
...
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>
...
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>${spock-core.version}</version>
<scope>test</scope>
</dependency>
...
<dependency>
<groupId>org.codehaus.groovy.modules.http-builder</groupId>
<artifactId>http-builder</artifactId>
<version>0.7</version>
<scope>test</scope>
</dependency>
...
</dependencies>
<build>
<finalName>dss</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/resources</directory>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<compilerId>groovy-eclipse-compiler</compilerId>
<verbose>false</verbose>
<compilerArguments>
<javaAgentClass>lombok.core.Agent</javaAgentClass>
</compilerArguments>
<fork>true</fork>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-compiler</artifactId>
<version>2.9.1-01</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-batch</artifactId>
<version>2.3.7-01</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</dependency>
</dependencies>
</plugin>
...
</plugins>
</build>
<profiles>
<profile>
<id>dss</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>deliverable</name>
<value>dss</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<version>2.1-alpha-1</version>
<executions>
<execution>
<goals>
<goal>rpm</goal>
</goals>
</execution>
</executions>
<configuration>
...
<name>${deliverable}</name>
<projversion>${pom.version}</projversion>
<release>${BUILD_NUMBER}</release>
<description>Search: RPM package</description>
<mappings>
<mapping>
<directory>${tomcatInstallationDir}</directory>
<filemode>755</filemode>
<username>tomcat</username>
<groupname>tomcat</groupname>
<sources>
<source>
<location>../Tomcat/</location>
</source>
</sources>
</mapping>
<mapping>
<directory>${tomcatInstallationDir}/webapps</directory>
<filemode>755</filemode>
<username>tomcat</username>
<groupname>tomcat</groupname>
<sources>
<source>
<location>target/${deliverable}.war
</location>
<destination>${deliverable}.war</destination>
</source>
</sources>
</mapping>
</mappings>
<requires>
<require>palm-jre >= 1.6.0_27-fcs</require>
</requires>
<prefix>${tomcatInstallationDir}</prefix>
<preinstallScriptlet>
<scriptFile>../PlatformEngine/rpm_scripts/pre_install.sh</scriptFile>
<fileEncoding>utf-8</fileEncoding>
</preinstallScriptlet>
<postinstallScriptlet>
<scriptFile>../PlatformEngine/rpm_scripts/post_install.sh</scriptFile>
<fileEncoding>utf-8</fileEncoding>
</postinstallScriptlet>
<preremoveScriptlet>
<scriptFile>../PlatformEngine/rpm_scripts/pre_uninstall.sh</scriptFile>
<fileEncoding>utf-8</fileEncoding>
</preremoveScriptlet>
<postremoveScriptlet>
<scriptFile>../PlatformEngine/rpm_scripts/post_uninstall.sh</scriptFile>
<fileEncoding>utf-8</fileEncoding>
</postremoveScriptlet>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
现在,在我的 .m2 目录中,我为 groovy-all
项目找到了一个 pom/sha1 和一个 jar 文件。但是对于 groovy-eclipse-compiler
,我看到 pom/sha1, 但没有 jar 文件 。
我是不是做错了什么? Codehaus 迁移本身是否以某种方式搞砸了?或者(更糟)两者都有?
maven 工件已经在中央很长时间了,没有迁移可能会搞砸这些。
由于我不是行家专家,所以我只能告诉您我认为是原因的原因。查看 groovy-eclipse-compiler 版本 2.9.1-01 的 pom,我看到
<repositories>
<repository>
<id>codehaus.org</id>
<url>http://repository.codehaus.org</url>
</repository>
</repositories>
ans 我的假设是,这将导致 Maven 查找该存储库,该存储库不再存在。如果这是真的,那么我对解决方案的建议是手动安装工件(它们都在 Maven Central 上)或使用不同的工具,如 gradle(尽管这可能超出你的范围)到进行构建。
编辑: 有人告诉我,您可以更改 settings.xml 以使用如下模式修复存储库配置:
<repositories>
<repository>
<id>codehaus.org</id>
<url>http://nexus.codehaus.org/<some suburl></url>
</repository>
</repositories>
例如使用 http://mvnrepository.com/artifact 可能会起作用,但我还没有测试过。
您引用的工件:
org.codehaus.groovy:groovy-eclipse-compiler:maven-plugin:2.9.1-01
如果您的构建没有找到它,那么只是您的配置有误。 network/proxy 问题等(请参阅您的 settings.xml)您可以通过以下方式在 Maven 中心搜索此工件:http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.codehaus.groovy%22%20AND%20a%3A%22groovy-eclipse-compiler%22
除了添加补充存储库之外,这没有帮助。此外,像这样在 Maven pom 中添加默认值:
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/resources</directory>
</testResource>
</testResources>
也没有意义,因为这些是默认值。我也偶然发现你正在定义编码之类的东西:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
首先像这样定义插件的版本是好的(但你应该使用uptodate versions)但是你不应该在每个插件中定义编码。为此,存在 属性:
<project>
...
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
...
</project>
通过使用上面的代码,您不需要为每个插件提供编码,因为 maven-resources-plugin, maven-compiler-plugin 等插件定义了默认值。
关于 codehaus migration 的一句话。这意味着只有他们为开发人员提供的服务正在关闭,而不是已经属于 Maven Central 的内容。
我建议在您自己的基础架构中安装一个存储库管理器。