maven-wrapper.properties:没有这样的文件

时间:2018-11-28 17:36:41

标签: continuous-integration maven-3 travis-ci

我正在将travis-ci应用于基于Maven的Spring Boot应用程序。 我已经使用命令mvn -N io.takari:maven:wrapper在项目的根文件夹(与父pom级别相同)中安装了mvnw。 这是文件夹结构:

-repo-folder
  -my-project-parent
    -.mvn
    -mvnw
    -pom.xml
  -.travis.yml

当Travis-ci运行时,我得到:

./my-project-parent/mvnw clean install
./my-project-parent/mvnw: 216: ./my-project-parent/mvnw: cannot open /home/travis/build/hVest/repo-folder/.mvn/wrapper/maven-wrapper.properties: No such file
/home/travis/build/hVest/repo-folder/.mvn/wrapper/maven-wrapper.jar: No such file or directory
Error: Could not find or load main class org.apache.maven.wrapper.MavenWrapperMain
Caused by: java.lang.ClassNotFoundException: org.apache.maven.wrapper.MavenWrapperMain

由于某种原因,它会搜索包装文件夹uder repo-folder。

这是我的.travis.yml文件:

sudo: true
language: java
jdk: oraclejdk9
os: linux
before_install:
  - chmod +x ./my-project-parent/*
install: true
script: ./my-project-parent/mvnw clean install
cache:
  directories:
  - $HOME/.m2

我如何使其工作?

1 个答案:

答案 0 :(得分:-2)

要解决此特定问题,我做了以下事情:

  • 我将.mvn文件夹上移了一层,直到/repo-folder(。travis.yml也驻留在其中)。
  • 我对.travis.yml进行了如下更改:

sudo: true language: java jdk: oraclejdk9 os: linux before_install: - chmod +x ./my-project-parent/* - cd my-project-parent install: true script: ./mvnw clean install cache: directories: - $HOME/.m2

但是现在得到了(这将导致my next question ..)

[ERROR]   The project io.safeblocks:firewall-parent:1.0-SNAPSHOT (/home/travis/build/hVest/repo-folder/my-project-parent/pom.xml) has 1 error
[ERROR]     Child module /home/travis/build/hVest/repo-folder/my-project-parent/child-module of /home/travis/build/hVest/repo-folder/my-project-parent/pom.xml does not exist