我有一個項目document-scanner-aggregator在Maven 3.1.1運行時本地運行,即~/apache-maven-3.1.1/bin/mvn clean install
,但不是on travis-ci.org,它檢測到Maven 3.2.5,它可疑是由travis-ci.org提供的版本。但是它不應該這樣做,因爲運行構建的Maven版本應該被強制執行,對吧?爲什麼在travis-ci.org上運行3.1.1時,maven-enforcer-plugin會檢測Maven 3.2.5?
故障是
[WARNING] Rule 0: org.apache.maven.plugins.enforcer.RequireMavenVersion failed with message:
Detected Maven Version: 3.2.5 is not in the allowed range (,3.2).
...
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:1.4:enforce (enforce-versions) on project javaocr-parent: Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed. -> [Help 1]
和配置是
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>enforce-versions</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<!--different rules for different issues-->
<!--3.3.x causes `java.lang.NoClassDefFoundError: org/eclipse/aether/spi/connector/Transfer$State` which is caused by certain maven versions, see https://cwiki.apache.org/confluence/display/MAVEN/AetherClassNotFound for details-->
<version>(,3.3)</version>
<!--3.2.x causes `No implementation for org.eclipse.aether.connector.wagon.WagonConfigurator was bound.`-->
<version>(,3.2)</version>
</requireMavenVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
在
javaocr
。
的.travis.yml
是
language: java
install:
- wget http://mirrors.ae-online.de/apache/maven/maven-3/3.1.1/binaries/apache-maven-3.1.1-bin.tar.gz && tar xf apache-maven-3.1.1-bin.tar.gz
- apache-maven-3.1.1/bin/mvn clean install
太棒了! '.travis.yml'做到了。我建議編輯答案,以便更快地獲得關鍵信息,因爲我有一種感覺,我不會成爲最後一個問題。 –