簡體   English   中英

Gitlab:您指定的目標需要一個項目來執行,但是此目錄中沒有POM

[英]Gitlab: The goal you specified requires a project to execute but there is no POM in this directory

我嘗試使用gitlab CI來構建和運行測試。

我使用默認.gitlab-ci.yml:

# This file is a template, and might need editing before it works on your project.
---
# Build JAVA applications using Apache Maven (http://maven.apache.org)
# For docker image tags see https://hub.docker.com/_/maven/
#
# For general lifecycle information see https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
#
# This template will build and test your projects as well as create the documentation.
#
# * Caches downloaded dependencies and plugins between invocation.
# * Verify but don't deploy merge requests.
# * Deploy built artifacts from master branch only.
# * Shows how to use multiple jobs in test stage for verifying functionality
#   with multiple JDKs.
# * Uses site:stage to collect the documentation for multi-module projects.
# * Publishes the documentation for `master` branch.

variables:
  # This will supress any download for dependencies and plugins or upload messages which would clutter the console log.
  # `showDateTime` will show the passed time in milliseconds. You need to specify `--batch-mode` to make this work.
  MAVEN_OPTS: "-Dhttps.protocols=TLSv1.2 -Dmaven.repo.local=.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true"
  # As of Maven 3.3.0 instead of this you may define these options in `.mvn/maven.config` so the same config is used
  # when running from the command line.
  # `installAtEnd` and `deployAtEnd` are only effective with recent version of the corresponding plugins.
  MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true"

# Cache downloaded dependencies and plugins between builds.
# To keep cache across branches add 'key: "$CI_JOB_NAME"'
cache:
  paths:
    - .m2/repository

# This will only validate and compile stuff and run e.g. maven-enforcer-plugin.
# Because some enforcer rules might check dependency convergence and class duplications
# we use `test-compile` here instead of `validate`, so the correct classpath is picked up.
.validate: &validate
  stage: build
  script:
    - 'mvn $MAVEN_CLI_OPTS test-compile'

# For merge requests do not `deploy` but only run `verify`.
# See https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
.verify: &verify
  stage: test
  script:
    - 'mvn $MAVEN_CLI_OPTS verify site site:stage'
  except:
    - master

# Validate merge requests using JDK7
validate:jdk7:
  <<: *validate
  image: maven:3.3.9-jdk-7

# Validate merge requests using JDK8
validate:jdk8:
  <<: *validate
  image: maven:3.3.9-jdk-8

# Verify merge requests using JDK7
verify:jdk7:
  <<: *verify
  image: maven:3.3.9-jdk-7

# Verify merge requests using JDK8
verify:jdk8:
  <<: *verify
  image: maven:3.3.9-jdk-8


# For `master` branch run `mvn deploy` automatically.
# Here you need to decide whether you want to use JDK7 or 8.
# To get this working you need to define a volume while configuring your gitlab-ci-multi-runner.
# Mount your `settings.xml` as `/root/.m2/settings.xml` which holds your secrets.
# See https://maven.apache.org/settings.html
deploy:jdk8:
  # Use stage test here, so the pages job may later pickup the created site.
  stage: test
  script:
    - 'mvn $MAVEN_CLI_OPTS deploy site site:stage'
  only:
    - master
  # Archive up the built documentation site.
  artifacts:
    paths:
    - target/staging
  image: maven:3.3.9-jdk-8


pages:
  image: busybox:latest
  stage: deploy
  script:
    # Because Maven appends the artifactId automatically to the staging path if you did define a parent pom,
    # you might need to use `mv target/staging/YOUR_ARTIFACT_ID public` instead.
    - mv target/staging public
  dependencies:
    - deploy:jdk8
  artifacts:
    paths:
    - public
  only:
    - master

當我運行管道失敗時,出現以下錯誤:

2288 [錯誤]您指定的目標需要執行一個項目,但此目錄中沒有POM(/ builds / IceCristall / the-great-triggering)。 請驗證您是否從正確的目錄中調用了Maven。 -> [幫助1] org.apache.maven.lifecycle.MissingProjectException:您指定的目標需要一個項目來執行,但此目錄中沒有POM(/ builds / IceCristall / the-great-triggering)。 請驗證您是否從正確的目錄中調用了Maven。

這是完整的日志:

Running with gitlab-runner 11.2.0-rc2 (1644837a)
  on docker-auto-scale ed2dce3a
Using Docker executor with image maven:3.3.9-jdk-8 ...
Pulling docker image maven:3.3.9-jdk-8 ...
Using docker image sha256:9997d8483b2fc521a4159feab922546dda0c5c22b5084f86dfab48f123ae4364 for maven:3.3.9-jdk-8 ...
Running on runner-ed2dce3a-project-7913048-concurrent-0 via runner-ed2dce3a-srm-1534626556-3eb27695...
Cloning repository...
Cloning into '/builds/IceCristall/the-great-triggering'...
Checking out e41a61bd as master...
Skipping Git submodules setup
Checking cache for default...
FATAL: file does not exist                         
Failed to extract cache
$ mvn $MAVEN_CLI_OPTS test-compile
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T16:41:47+00:00)
Maven home: /usr/share/maven
Java version: 1.8.0_121, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "4.14.48-coreos-r2", arch: "amd64", family: "unix"
2053 [INFO] Error stacktraces are turned on.
2152 [INFO] Scanning for projects...
2252 [INFO] ------------------------------------------------------------------------
2253 [INFO] BUILD FAILURE
2253 [INFO] ------------------------------------------------------------------------
2254 [INFO] Total time: 0.133 s
2254 [INFO] Finished at: 2018-08-18T21:12:14+00:00
2286 [INFO] Final Memory: 6M/56M
2287 [INFO] ------------------------------------------------------------------------
2288 [ERROR] The goal you specified requires a project to execute but there is no POM in this directory (/builds/IceCristall/the-great-triggering). Please verify you invoked Maven from the correct directory. -> [Help 1]
org.apache.maven.lifecycle.MissingProjectException: The goal you specified requires a project to execute but there is no POM in this directory (/builds/IceCristall/the-great-triggering). Please verify you invoked Maven from the correct directory.
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:84)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
2299 [ERROR] 
2299 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
2299 [ERROR] 
2299 [ERROR] For more information about the errors and possible solutions, please read the following articles:
2300 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException
ERROR: Job failed: exit code 1

當我理解此日志后,正確的項目是從我的存儲庫中的Docker容器中的路徑下復制:/ builds / IceCristall / the-great-triggering

現在執行了mvn命令,但未找到pom.xml

我有點困惑,因為pom.xml位於“ the-great-triggering”文件夾中。

我也找不到我可以在ci config文件中定義此路徑的位置。

任何人都對這個問題有疑問,我可以在哪里找到它?

錯誤消息顯示:“此目錄中沒有POM(/ builds / IceCristall / the-great-triggering)。”。 您確定已提交pom.xml文件並將其推送到存儲庫的必需分支嗎?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM