Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

»Unknown lifecycle phase "/root/.m2"« when using mvnw #301

Open
bmarwell opened this issue Oct 4, 2022 · 4 comments
Open

»Unknown lifecycle phase "/root/.m2"« when using mvnw #301

bmarwell opened this issue Oct 4, 2022 · 4 comments

Comments

@bmarwell
Copy link

bmarwell commented Oct 4, 2022

Hi!

I tried your images, but I am unable to use mvnw. The wrapper script seems to do a bit too much of magic.
The maven image was chosen because I could not find any other image with both git and java installed.

Maven command

https://github.com/georgberky/dependency-update-maven-plugin/blob/47490170e35f70e986fa843860eb5395e942d392/.drone.yml#L17-L25

      - |
        ./mvnw \
          --show-version \
          --fail-at-end \
          --batch-mode \
          --no-transfer-progress \
          verify \
          site site:stage \
          -Pdocs

##Drone CI output

https://cloud.drone.io/georgberky/dependency-update-maven-plugin/142/1/2

+ git config --global user.email "[email protected]"
+ git config --global user.name "dependency-update-maven-plugin"
+ ./mvnw   --show-version   --fail-at-end   --batch-mode   --no-transfer-progress   verify   site site:stage   -Pdocs

--2022-10-03 19:44:20--  https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar
Resolving repo.maven.apache.org (repo.maven.apache.org)... 151.101.208.215
Connecting to repo.maven.apache.org (repo.maven.apache.org)|151.101.208.215|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 58727 (57K) [application/java-archive]
Saving to: ‘/drone/src/.mvn/wrapper/maven-wrapper.jar’

     0K .......... .......... .......... .......... .......... 87% 12.5M 0s
    50K .......                                               100% 15.2M=0.004s

2022-10-03 19:44:20 (12.8 MB/s) - ‘/drone/src/.mvn/wrapper/maven-wrapper.jar’ saved [58727/58727]

Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
Maven home: /root/.m2/wrapper/dists/apache-maven-3.8.6-bin/1ks0nkde5v1pk9vtc31i9d0lcd/apache-maven-3.8.6
Java version: 1.8.0_345, vendor: Temurin, runtime: /opt/java/openjdk/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.15.0-154-generic", arch: "amd64", family: "unix"
[INFO] Scanning for projects...
[INFO] 
[INFO] --< io.github.georgberky.maven.plugins.depsupdate:dependency-update-maven-plugin >--
[INFO] Building io.github.georgberky.maven.plugins.depsupdate:dependency-update-maven-plugin 0.9.0-SNAPSHOT
[INFO] ----------------------------[ maven-plugin ]----------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.230 s
[INFO] Finished at: 2022-10-03T19:44:23Z
[INFO] ------------------------------------------------------------------------
[ERROR] Unknown lifecycle phase "/root/.m2". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/LifecyclePhaseNotFoundException

... will add -e (--errors) and see what it says.

@bmarwell
Copy link
Author

bmarwell commented Oct 4, 2022

Build with --errors does not give any more useful information.
https://cloud.drone.io/georgberky/dependency-update-maven-plugin/144/1/2

@carlossg
Copy link
Owner

carlossg commented May 14, 2023

this means that something is passing $HOME to mvn as argument

I cannot try it because going to the link you provided I cannot clone that commit

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

@carlossg
Copy link
Owner

found the PR, the problem is that mvnw takes MAVEN_CONFIG as args, and these images set MAVEN_CONFIG to the .m2 dir

# Provide a "standardized" way to retrieve the CLI args that will
# work with both Windows and non-Windows executions.
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"

so you would need to unset MAVEN_CONFIG before calling mvnw

it was reported also as https://issues.jenkins.io/browse/JENKINS-47890

@carlossg
Copy link
Owner

this was actually fixed or mitigated 5 years ago in 0490eff when using the entrypoint

iperdomo added a commit to integratedmodelling/klab that referenced this issue Jan 17, 2024
* We use a new jdk17 agent without maven installed to avoid the
  `MAVEN_CONFIG` environment variable

* carlossg/docker-maven#301 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants