Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
We want to execute a simple maven command manually to deploy a test job on Nexus repository.
we used this command on windows 10 with jdk 11 and commandline is properly installed.
mvn -X -f C:/TalendV8.0.1/Talend-Studio-20211109_1610-V8.0.1/workspace/.repositories/1952701422/main/TESTV8/poms/pom.xml clean deploy
-s C:\cmdline\studio\CI_dir\maven_settings.xml
-Dworkspace=C:/cmdline/studio/commandline-workspace
-Dproduct.path=C:/cmdline/studio
-Dlicense.path=C:/cmdline/studio/license
-Dtalend.studio.p2.base=https://update.talend.com/Studio/8/base
-Dtalend.studio.p2.update=https://update.talend.com/Studio/8/updates/R2022-01
-DaltDeploymentRepository=snapshots::default::http://XXXX:8081/repository/snapshots/
-fae -e
When the settings file looks like this :
[ERROR] Failed to execute goal org.talend.ci:builder-maven-plugin:8.0.3:generate (default) on project code.Master: Execution default of goal org.talend.ci:builder-maven-plugin:8.0.3:generate failed.: NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.talend.ci:builder-maven-plugin:8.0.3:generate (default) on project code.Master: Execution default of goal org.talend.ci:builder-maven-plugin:8.0.3:generate failed.
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:306)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:211)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:165)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:157)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:121)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:127)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:294)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default of goal org.talend.ci:builder-maven-plugin:8.0.3:generate failed.
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:148)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:301)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:211)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:165)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:157)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:121)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:127)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:294)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: java.lang.NullPointerException
at java.util.concurrent.ConcurrentHashMap.putVal (ConcurrentHashMap.java:1011)
at java.util.concurrent.ConcurrentHashMap.put (ConcurrentHashMap.java:1006)
at java.util.Properties.put (Properties.java:1329)
at java.util.Properties.setProperty (Properties.java:229)
at org.talend.jobbuilder.JobBuilder.setSignerSessionInfo (JobBuilder.java:516)
at org.talend.jobbuilder.JobBuilder.execute (JobBuilder.java:467)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:301)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:211)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:165)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:157)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:121)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:127)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:294)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[ERROR]
[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/PluginExecutionException
Any help ?
Ok my bad ! I found the problem. I was pointing to a wrong pom.xml
In case if someone needs to do the same here are the steps with the Talend version 8 :
1- Install the command Line to a different path something like (C:/cmdLine/studio)
2- Make sure to use the appropriate JDK (JDK 11 for Talend v8)
3- Retrieve and adapt the maven_settings.xml from the documentation link https://help.talend.com/r/en-US/8.0/software-dev-lifecycle-best-practices-guide/main-maven-options-...
4- Make sure that your settings file contains the localRepository (you won't be able to compile all dependencies if you don't specify the path.)
<localRepository>C:/cmdline/studio/configuration/.m2/repository</localRepository>
5- You will maybe face a "blocked mirror error" if you are connecting to nexus without SSL. Maven now disables all insecure http://* mirrors by default. To solve this problem you have to comment this part in your maven conf/settings.xml.
6- Use this maven command to clean and deploy to Nexus : Like I said before make sure to point to the right pom.xml of your job you want to deploy. And don't forget the -s option for the maven_settings.xml.
mvn -X -f C:/TalendV8.0.1/Talend-Studio-20211109_1610-V8.0.1/workspace/.repositories/1952701422/main/TESTV8/poms/jobs/process/MigrationAPI/j01_metaservletapi_createuserusergroup_0.1/pom.xml clean deploy
-s C:/cmdline/studio/CI_dir/maven_settings.xml
-Dproduct.path=C:/cmdline/studio
-Dlicense.path=C:/cmdline/studio/license
-Dtalend.studio.p2.base=https://update.talend.com/Studio/8/base
-Dtalend.studio.p2.update=https://update.talend.com/Studio/8/updates/R2022-03
-DaltDeploymentRepository=snapshots::default::http://XXXXXXXX:8081/repository/snapshots/
-fae -e
you can see most of important options here : https://help.talend.com/r/en-US/8.0/software-dev-lifecycle-best-practices-guide/ci-mvn-options
7- If you are deploying a snapshot to a Nexus snapshot repository it won't work ! You will get something like this if your job is in version 0.1.0 : Error 400 Repository version policy: SNAPSHOT does not allow version: 0.1.0 .
All you have to do is to make sure that you is to check this :
your pom.xml of your job will look like this :
Safus.
Ok my bad ! I found the problem. I was pointing to a wrong pom.xml
In case if someone needs to do the same here are the steps with the Talend version 8 :
1- Install the command Line to a different path something like (C:/cmdLine/studio)
2- Make sure to use the appropriate JDK (JDK 11 for Talend v8)
3- Retrieve and adapt the maven_settings.xml from the documentation link https://help.talend.com/r/en-US/8.0/software-dev-lifecycle-best-practices-guide/main-maven-options-...
4- Make sure that your settings file contains the localRepository (you won't be able to compile all dependencies if you don't specify the path.)
<localRepository>C:/cmdline/studio/configuration/.m2/repository</localRepository>
5- You will maybe face a "blocked mirror error" if you are connecting to nexus without SSL. Maven now disables all insecure http://* mirrors by default. To solve this problem you have to comment this part in your maven conf/settings.xml.
6- Use this maven command to clean and deploy to Nexus : Like I said before make sure to point to the right pom.xml of your job you want to deploy. And don't forget the -s option for the maven_settings.xml.
mvn -X -f C:/TalendV8.0.1/Talend-Studio-20211109_1610-V8.0.1/workspace/.repositories/1952701422/main/TESTV8/poms/jobs/process/MigrationAPI/j01_metaservletapi_createuserusergroup_0.1/pom.xml clean deploy
-s C:/cmdline/studio/CI_dir/maven_settings.xml
-Dproduct.path=C:/cmdline/studio
-Dlicense.path=C:/cmdline/studio/license
-Dtalend.studio.p2.base=https://update.talend.com/Studio/8/base
-Dtalend.studio.p2.update=https://update.talend.com/Studio/8/updates/R2022-03
-DaltDeploymentRepository=snapshots::default::http://XXXXXXXX:8081/repository/snapshots/
-fae -e
you can see most of important options here : https://help.talend.com/r/en-US/8.0/software-dev-lifecycle-best-practices-guide/ci-mvn-options
7- If you are deploying a snapshot to a Nexus snapshot repository it won't work ! You will get something like this if your job is in version 0.1.0 : Error 400 Repository version policy: SNAPSHOT does not allow version: 0.1.0 .
All you have to do is to make sure that you is to check this :
your pom.xml of your job will look like this :
Safus.
Hello,
Great this issue is fixed by yourself and really thanks for sharing your solution with us.
Best regards
Sabrina
You can change the Maven Version (snapshot / release) from CI as well, by using executeScript see:
https://help.talend.com/r/en-US/8.0/software-dev-lifecycle-best-practices-guide/regenerate-pom-files search changeMavenVersion
As for the <localRepository> section it's really hectic in most of the cases. As we also have a maven running inside the studio / patch manager there can be some conflicts about how these 3-4 processes identify the ~/.m2 folder.
In case of Azure / Jenkins we don't need the localRepository section.
The jenkins_helper is built using the M2_HOME environment variable to override the .m2 folders location (making it somewhat backward compatible), (which is yet another way to control the identification of ~/.m2 )