Helidon quickstart Docker build not finding parent specified in pom.xml - docker

When I build the example in Maven it works fine; however when I try to do the docker build, it errors out. Has anyone else come across this or have a fix? I can build other docker images just fine. thanks in advance.
Here is my command line build results:
S:~/eclipse-workspace/helidon-quickstart-se$ docker build -t helidon-quickstart-se .
Sending build context to Docker daemon 65.54kB
Step 1/13 : FROM maven:3.6-jdk-11 as build
---> e23b595c92ad
Step 2/13 : WORKDIR /helidon
---> Using cache
---> 479d1d20bfa8
Step 3/13 : ADD pom.xml .
---> Using cache
---> d945f45c3d4c
Step 4/13 : RUN mvn package -Dmaven.test.skip -Declipselink.weave.skip
---> Running in 8b058d39dad3
[INFO] Scanning for projects...
Downloading from central: https://repo.maven.apache.org/maven2/io/helidon/applications/helidon-se/2.4.2/helidon-se-2.4.2.pom
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for io.helidon.examples:helidon-quickstart-se:1.0-SNAPSHOT: Could not transfer artifact io.helidon.applications:helidon-se:pom:2.4.2 from/to central (https://repo.maven.apache.org/maven2): Transfer failed for https://repo.maven.apache.org/maven2/io/helidon/applications/helidon-se/2.4.2/helidon-se-2.4.2.pom and 'parent.relativePath' points at no local POM # line 7, column 13
#
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project io.helidon.examples:helidon-quickstart-se:1.0-SNAPSHOT (/helidon/pom.xml) has 1 error
[ERROR] Non-resolvable parent POM for io.helidon.examples:helidon-quickstart-se:1.0-SNAPSHOT: Could not transfer artifact io.helidon.applications:helidon-se:pom:2.4.2 from/to central (https://repo.maven.apache.org/maven2): Transfer failed for https://repo.maven.apache.org/maven2/io/helidon/applications/helidon-se/2.4.2/helidon-se-2.4.2.pom and 'parent.relativePath' points at no local POM # line 7, column 13: Unknown host repo.maven.apache.org: Temporary failure in name resolution -> [Help 2]
[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/ProjectBuildingException
[ERROR] [Help 2] 'http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException..'
The command '/bin/sh -c mvn package -Dmaven.test.skip -Declipselink.weave.skip' returned a non-zero code: 1

I may be missing something, but isn't this simply a very basic problem with your connectivity to Maven Central? From the stack trace you posted:
Could not transfer artifact io.helidon.applications:helidon-se:pom:2.4.2 from/to central (https://repo.maven.apache.org/maven2): Transfer failed for https://repo.maven.apache.org/maven2/io/helidon/applications/helidon-se/2.4.2/helidon-se-2.4.2.pom and 'parent.relativePath' points at no local POM # line 7, column 13
But, as you can see, of course, the artifact most certainly does exist. Perhaps whatever is doing the fetching is behind a network proxy?

Related

Maven Error Unknown host repo.maven.apache.org

I am trying to build a docker container using docker-compose build on a CentOS Linux release 8.2.2004. When I execute the command I get the following error message
[ERROR] Plugin org.apache.maven.plugins:maven-javadoc-plugin:3.1.1 or one of its dependencies could not be resolved:
Failed to read artifact descriptor for org.apache.maven.plugins:maven-javadoc-plugin:jar:3.1.1:
Could not transfer artifact org.apache.maven.plugins:maven-javadoc-plugin:pom:3.1.1 from/to central (https://repo.maven.apache.org/maven2):
Transfer failed for https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-javadoc-plugin/3.1.1/maven-javadoc-plugin-3.1.1.pom:
Unknown host repo.maven.apache.org: Temporary failure in name resolution -> [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/PluginResolutionException
ERROR: Service 'web' failed to build: The command '/bin/sh -c mvn clean package -am -DskipTests -Dmaven.javadoc.skip=true -P deployment' returned a non-zero code: 1
When I build the docker container on my local machine it works just fine. So there is no issue with the container or any configuration within. I have done some research which suggest there might be a proxy problem on the CentOS Server, but echo "$HTTP_PROXY" and echo "$HTTPS_PROXY" return an empty line - thus I suppose there is no proxy used.
Also when I execute curl https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-javadoc-plugin/3.1.1/maven-javadoc-plugin-3.1.1.pom I get a proper looking xml file.
When I execute curl https://repo.maven.apache.org/maven2I get
<html>
<head><title>302 Moved Temporarily</title></head>
<body>
<h1>302 Moved Temporarily</h1>
<ul>
<li>Code: Found</li>
<li>Message: Resource Found</li>
<li>RequestId: 235378792B04A00C</li>
<li>HostId: b2HKaI47VR5MaiW8bmG9FUGxgZ7u97XeT5Bfm/rs54wVSNjH0hNQsZ2/d4sGaACGboThVlIo5iM=</li>
</ul>
<hr/>
</body>
</html>
curl -L https://repo.maven.apache.org/maven2 shows me a long html document (as intended).
Any help would be greatly appreciated

Gitlab-runner docker executor trying to download maven dependencies

I've got a gitalb-runner running as a docker container.
This is my failed job for a mvn test command:
Running with gitlab-runner 10.4.0 (857480b6)
on mvn-build (ae93a255)
Using Docker executor with image maven:3.3.9-jdk-8 ...
Using docker image sha256:b4b185fdfd711067c07e8a1df1257645aff2781402dc147e52d9a09636f9a139 for predefined container...
Pulling docker image maven:3.3.9-jdk-8 ...
Using docker image maven:3.3.9-jdk-8 ID=sha256:9997d8483b2fc521a4159feab922546dda0c5c22b5084f86dfab48f123ae4364 for build container...
Running on runner-ae93a255-project-2-concurrent-0 via 49682264df2f...
Fetching changes...
HEAD is now at e197d19 Fixed yml
Checking out e197d191 as dev...
Skipping Git submodules setup
$ echo "Building project with maven"
Building project with maven
$ mvn $MAVEN_OPTS test
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building rest-client
[INFO] ------------------------------------------------------------------------
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.6/maven-resources-plugin-2.6.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 21.626 s
[INFO] Finished at: 2018-02-21T15:00:07+00:00
[INFO] Final Memory: 9M/118M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6: Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.6 from/to central (https://repo.maven.apache.org/maven2): Connect to repo.maven.apache.org:443 [repo.maven.apache.org/151.101.12.215] failed: Connection refused (Connection refused) -> [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/PluginResolutionException
ERROR: Job failed: exit code 1
My question is do I really need to set up a proxy and have an internet connection?
Or there is any other option to provide maven with that missing plugin?
I mention that I've already configured repo mapping in config.toml:
oncurrent = 1
check_interval = 0
[[runners]]
name = "mvn-build"
url = "http://192.168.233.128/"
token = "ae93a255f60d0e1abdb26cc9f72cd5"
executor = "docker"
[runners.docker]
tls_verify = false
image = "maven:3.3.9-jdk-8"
privileged = false
disable_cache = false
volumes = ["/cache","/var/run/docker.sock:/var/run/docker.sock","/root/.m2/repository/:/root/.m2/repository/"]
shm_size = 0
[runners.cache]
The Maven plugins are locally cached in the .m2/repository folder so you can make sure that all the needed plugins and dependencies are available in the /root/.m2/repository/ folder of the server/VM hosting the gitlab-runner. For example by running once the mvn test on the server.
You would probably want to avoid that as any time a dependency is changed you would need to ssh into the build server and update the local Maven cache there.
Considering this, setting up a proxy and internet connection once would not be that bad. Unless you have some other restrictions and/or would like to avoid downloading dependencies from external maven repos.
In this case maybe it is best to setup a maven repository within the organization which caches any external dependencies from Maven central

Permission denied while running maven command jenkins

I am facing permission denied issues while running a maven clean test on a pom.xml present in /home/tes/pom.xml from jenkins. Any suggestions
Building in workspace /var/lib/jenkins/workspace/jenkins
[jenkins] $ /usr/share/maven/bin/mvn -f /home/tes/pom.xml clean test
[INFO] Scanning for projects...
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project (/home/tes/pom.xml) has 1 error
[ERROR] Non-readable POM /home/tes/pom.xml: /home/tes/pom.xml (Permission denied)
[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/ProjectBuildingException
Build step 'Invoke top-level Maven targets' marked build as failure
Finished: FAILURE
Just grant read access for all to the pom.xml file:
chmod +r /home/tes/pom.xml
The moderator has deleted my previous answer; I know that it has passed some time since this first post, but I ended up exactly in the same place. I insist in complementing all the answers because I've found what was the problem in my case,having the same result as reported in this case.
I'd like to comment that, in my case, the reason was that I did not have JDK, but just JRE configured in JAVA_HOME of the Global Tool Configuration > JDK > JDK Installation. As a matter of fact Jenkins warns you that the path is not pointing to something containing a JDK.
JDK is needed for some Plugins, like Maven Integration or Docker Pipeline, as Java requirements section in Jenkins documentation states. So this must checked because it surprisingly results in the weird error:
> git rev-parse refs/remotes/origin/celsus_0-1-0^{commit} # timeout=10
Checking out Revision 0c533cf2327a416a254afa2348abafe7790ba67f (refs/remotes/origin/celsus_0-1-0)
> git config core.sparsecheckout # timeout=10
> git checkout -f 0c533cf2327a416a254afa2348abafe7790ba67f # timeout=10
Commit message: "first embrio of container image"
> git rev-list --no-walk 0c533cf2327a416a254afa2348abafe7790ba67f # timeout=10
Parsing POMs
Established TCP socket on 40251
[build] $ /usr/lib/jvm/bin/java -cp /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven35-agent-1.13.jar:/usr/share/maven/boot/plexus-classworlds-2.x.jar:/usr/share/maven/conf/logging jenkins.maven3.agent.Maven35Main /usr/share/maven /var/cache/jenkins/war/WEB-INF/lib/remoting-4.5.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven35-interceptor-1.13.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.13.jar 40251
ERROR: Failed to parse POMs
java.io.IOException: Cannot run program "/usr/lib/jvm/bin/java" (in directory "/var/lib/jenkins/workspace/build"): error=2, No such file or directory
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
at hudson.Proc$LocalProc.<init>(Proc.java:252)
at hudson.Proc$LocalProc.<init>(Proc.java:221)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:996)
at hudson.Launcher$ProcStarter.start(Launcher.java:508)
at hudson.maven.AbstractMavenProcessFactory.newProcess(AbstractMavenProcessFactory.java:280)
at hudson.maven.ProcessCache.get(ProcessCache.java:236)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:802)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:514)
at hudson.model.Run.execute(Run.java:1907)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Caused by: java.io.IOException: error=2, No such file or directory
at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:340)
at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:271)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
... 13 more
Finished: FAILURE
Similar case as originated this case, as the different nature of the solutions proposed points out. I'd like to bring the attention that these errors having to do with permissions, or parsing of the pom might hide the real root cause, and error messages are not always as explicit and clear as they should be.
Hope it helps others bumping into the same issue.
I installed maven plugin for jenkins and provided the fully qualified path of pom.xml in root pom.xml and it fixed the issue
I think the reason this happens is maven has the right to run pom.xml ie. mvn command can be run through terminal but not through jenkins.
So we will need to add the current user to jenkins for it to work.
Follow this blogpost. It worked for me:
blogpost

Error while displaying javadocs in Jenkins

I am trying Jenkins with the help of the book - "Jenkins - The Definitive Guide"
I am getting error while displaying javadocs:
[ERROR] Plugin org.apache.maven.plugins:maven-install-plugin:2.5.2 or
one of its dependencies could not be resolved: Cannot access central
(https://repo.maven.apache.org/maven2) in offline mode and the
artifact org.apache.maven.plugins:maven-install-plugin:jar:2.5.2 has
not been downloaded from it before. -> [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/PluginResolutionException Build step 'Invoke top-level Maven targets' marked build as failure
Both Java and Maven are installed on the machine where Jenkins is running.
I have the following info from the command line
$ mvn -version
Apache Maven 3.3.9
Maven home: /usr/share/maven
Java version: 1.8.0_144, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-oracle/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.10.0-32-generic", arch: "amd64", family: "unix"
Any hint to get around this issue?
--------------------- EDIT ---------------------------
After the last comment I made the changes as suggested and now I got the following errors:
[ERROR] Failed to execute goal on project gameoflife-web: Could not resolve dependencies for project com.wakaleo.gameoflife:gameoflife-
web:war:1.0-SNAPSHOT: Could not find artifact
com.wakaleo.gameoflife:gameoflife-core:jar:1.0-SNAPSHOT -> [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/DependencyResolutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :gameoflife-web
Build step 'Invoke top-level Maven targets' marked build as failure
Recording test results
Publishing Javadoc
Finished: FAILURE

docker build fails in jhipster

Can someone point me in the right direction for the error below?
I have DOCKER_HOST set (192.168.99.100:2376)
I entered the following command on my windows box:
mvnw package -Pprod docker:build -DskipTests -e
All works fine but, when building the image, I am getting the following error:
[ERROR] Failed to execute goal
com.spotify:docker-maven-plugin:0.4.10:build (default-cli) on project
truup: Exception caught: java.util.concurrent.ExecutionException:
com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException:
org.apache.http.client.ClientProtocolException: The server failed to
respond with a valid HTTP response -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to
execute goal com.spotify:docker-maven-plugin:0.4.10:build
(default-cli) on project truup: Exception caught
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
It sounds like what described at ClientProtocolException (Windows 10 using Docker Toolbox).
Check these environment variables:
set DOCKER_HOST=tcp://192.168.99.100:2376
set DOCKER_MACHINE_NAME=default
set DOCKER_TLS_VERIFY=1
set DOCKER_TOOLBOX_INSTALL_PATH=C:\Program Files\Docker Toolbox
set DOCKER_CERT_PATH=C:\Users\myuserhere.docker\machine\machines\default

Resources