Maven mercurial extension constantly fails - mercurial

After 2+ hours I was able to get the maven-scm-provider-hg extension (for pushing to mercurial repos from Maven) semi working, meaning that it was executing commands instead of just giving errors.
However I think I've run into a wall with this error
[INFO] [deploy:deploy {execution: default-deploy}]
[INFO] Retrieving previous build number from pircbotx.googlecode.com
[INFO] Removing C:\DOCUME~1\Owner\LOCALS~1\Temp\wagon-scm1210107000.checkout\pir cbotx\pircbotx\1.3-SNAPSHOT
[INFO] EXECUTING: cmd.exe /X /C "hg clone -r tip https://*SNIP*#site.pircbotx.googlecode.com/hg/maven2/snapshots/pircbotx/pircbotx/1.3-SNAPSHOT C:\DOCUME~1\Owner\LOCALS~1\Temp\wagon-scm1210107000.checkout\pircbotx\pircbotx\1.3-SNAPSHOT"
[INFO] EXECUTING: cmd.exe /X /C "hg locate"
[INFO] repository metadata for: 'snapshot pircbotx:pircbotx:1.3-SNAPSHOT' could not be found on repository: pircbotx.googlecode.com, so will be created Uploading: scm:hg:https://site.pircbotx.googlecode.com/hg/maven2/snapshots/pircbotx/pircbotx/1.3-SNAPSHOT/pircbotx-1.3-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error deploying artifact: Error listing repository: No such command 'list'.
What on earth would cause that error? I'm on a Windows box, so any commands that aren't commands give "'list' is not recognized as an internal or external command...", not "No such command 'list'."
POM
<build>
<extensions>
<extension>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-hg</artifactId>
<version>1.4</version>
</extension>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-scm</artifactId>
<version>1.0-beta-7</version>
</extension>
</extensions>
...
<distributionManagement>
<snapshotRepository>
<id>pircbotx.googlecode.com</id>
<name>PircBotX Site</name>
<url>scm:hg:https://site.pircbotx.googlecode.com/hg/maven2/snapshots</url>
<uniqueVersion>false</uniqueVersion>
</snapshotRepository>
</distributionManagement>
Mercurial version
W:\programming\pircbot-hg>hg version
Mercurial Distributed SCM (version 1.7.2)
Any suggestions?

Firstly, not sure if deploying the project artifacts to an SCM is a normal practice. maven scm plugin is usually used for source code related operations like checkout/update/tag, etc.
Secondly, the cause of the error seems to be related to the fact that maven scm provider for hg does not support the list command as specified in this scm providers matrix. Not sure why and how mvn deploy uses this command though.

Related

Trouble running Maven in the quickstart guide

I am working through the Digital Asset quickstart guide. I am having trouble running:
mvn clean compile exec:java
I get the following error:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.373 s
[INFO] Finished at: 2019-02-13T17:22:14-05:00
[INFO] Final Memory: 10M/50M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project daml-quickstart-java: Could not resolve dependencies for project quickstart:daml-quickstart-java:jar:1.0.0: Failed to collect dependencies at com.daml.ledger:bindings-java:jar:2.5.2: Failed to read artifact descriptor for com.daml.ledger:bindings-java:jar:2.5.2: Could not transfer artifact com.daml.ledger:bindings-java:pom:2.5.2 from/to bintray-digitalassetsdk-DigitalAssetSDK (https://digitalassetsdk.bintray.com/DigitalAssetSDK): Not authorized , ReasonPhrase:Unauthorized. -> [Help 1]
How do I get authorization?
To use the Java bindings you need to set up Maven to work with the Digital Asset Maven repository in Bintray.
Log in to Bintray
Open the Bintray repository main page
Click on the SET ME UP! button and download the settings.xml file
If you already have a ~/.m2/settings.xml, integrate the downloaded file with
it. Otherwise, copy the downloaded settings.xml file to ~/.m2/settings.xml.
Go to your Bintray profile page. Here you can get your Bintray username (<name>#digitalassetsdk, displayed below Edit Your Profile) and your Bintray API key, which you’ll need in the next step.
In settings.xml, change the username and the apikey fields to your Bintray username and API key.
You can also find these instructions with direct Bintray links in the documentation.

unable to compile apache drill code

I cloned the drill git repository and when I run
mvn clean package -DskipTests
I get this error
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:1.3.1:enforce (validate_java_and_maven_version) on project drill-root: Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed. -> [Help 1]
You need to use JDK 1.7 to build Apache Drill.
The Drill team added maven-enforcer-plugin to the build process to make sure that build gives an error if someone tries to build using an unsupported version of Java or Maven. If you scroll up you will see an earlier error message like the following:
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (validate_java_and_maven_version) # drill-root ---
[WARNING] Rule 1: org.apache.maven.plugins.enforcer.RequireJavaVersion failed with message:
Detected JDK Version: 1.8.0-51 is not in the allowed range [1.7,1.8).
A lot of people want to run Drill using JDK 1.8. There's good news on that front. While you can't build using JDK 1.8, once you've built, you can run Drill with JDK 1.8 just fine.

Maven + Mercurial: Error while executing command tag

I want to release a new version of my project using the Maven-Release-Plugin.
I get the following error, though:
[INFO] Tagging release with the label softsmithy-lib-v0.1...
[INFO] EXECUTING: /bin/sh -c cd /var/lib/hudson/jobs/SoftSmithy-Utility-Library-Release && hg tag --message '[maven-release-plugin] copy for tag softsmithy-lib-v0.1' softsmithy-lib-v0.1
[ERROR]
EXECUTION FAILED
Execution of cmd : tag failed with exit code: 255.
Working directory was:
/var/lib/hudson/jobs/SoftSmithy-Utility-Library-Release
Your Hg installation seems to be valid and complete.
Hg version: 1.7.5 (OK)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] An error is occurred in the tag process: Exception while executing SCM command.
Error while executing command tag --message [maven-release-plugin] copy for tag softsmithy-lib-v0.1 softsmithy-lib-v0.1
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: An error is occurred in the tag process: Exception while executing SCM command.
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:284)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: An error is occurred in the tag process: Exception while executing SCM command.
at org.apache.maven.plugins.release.PrepareReleaseMojo.prepareRelease(PrepareReleaseMojo.java:215)
at org.apache.maven.plugins.release.PrepareReleaseMojo.execute(PrepareReleaseMojo.java:181)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
... 17 more
Caused by: org.apache.maven.shared.release.ReleaseExecutionException: An error is occurred in the tag process: Exception while executing SCM command.
at org.apache.maven.shared.release.phase.ScmTagPhase.execute(ScmTagPhase.java:113)
at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:203)
at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:140)
at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:103)
at org.apache.maven.plugins.release.PrepareReleaseMojo.prepareRelease(PrepareReleaseMojo.java:211)
... 20 more
Caused by: org.apache.maven.scm.ScmException: Exception while executing SCM command.
at org.apache.maven.scm.command.AbstractCommand.execute(AbstractCommand.java:63)
at org.apache.maven.scm.provider.hg.HgScmProvider.tag(HgScmProvider.java:239)
at org.apache.maven.scm.provider.AbstractScmProvider.tag(AbstractScmProvider.java:706)
at org.apache.maven.shared.release.phase.ScmTagPhase.execute(ScmTagPhase.java:109)
... 24 more
Caused by: org.apache.maven.scm.ScmException: Error while executing command tag --message [maven-release-plugin] copy for tag softsmithy-lib-v0.1 softsmithy-lib-v0.1
at org.apache.maven.scm.provider.hg.command.tag.HgTagCommand.executeTagCommand(HgTagCommand.java:105)
at org.apache.maven.scm.command.tag.AbstractTagCommand.executeCommand(AbstractTagCommand.java:81)
at org.apache.maven.scm.command.AbstractCommand.execute(AbstractCommand.java:59)
... 27 more
I tried to run
/bin/sh -c cd /var/lib/hudson/jobs/SoftSmithy-Utility-Library-Release && hg tag --message '[maven-release-plugin] copy for tag softsmithy-lib-v0.1' softsmithy-lib-v0.1
and it worked fine!
Any ideas what is going wrong?
PS: I noted that on the following site:
http://maven.apache.org/scm/matrix.html
it is mentioned that the Mercurial tag command is not supported, but it seems to execute the command (and then fails somehow). How can I use the Maven Release Plugin with Mercurial?
PPS: This only seems to happen for multi-module projects. Single POM project runs fine. I tried -DpreparationGoals="clean install" but it didn't help.
I finally found the solution:
The required parent POM
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>6</version>
uses Maven Release Plugin version 2.0
Unfortunatly, there is an issue with multi-module projects using Mercurial.
The issue goes away, when using version 2.1
Work-around: override the version in the project POM/ project parent POM.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.1</version>
<configuration>
<mavenExecutorId>forked-path</mavenExecutorId>
<useReleaseProfile>false</useReleaseProfile>
<arguments>-Psonatype-oss-release</arguments>
</configuration>
</plugin>
I filed an issue here:
https://issues.sonatype.org/browse/OSSRH-1388
If you look at the source file for HgTagCommand.java, it includes a few places where this kind of exception is launched (i.e. "Error while executing command"):
The one regarding tag [message] is:
ScmResult result = HgUtils.execute( branchConsumer, getLogger(), workingDir, branchCmd );
HgScmProviderRepository repository = (HgScmProviderRepository) scmProviderRepository;
if ( !result.isSuccess() )
{
throw new ScmException( "Error while executing command " + joinCmd( branchCmd ) );
}
And that don't look compatible with a multi-modules project, where you can have multiple Mercurial repositories.
I had the same problem, it was because of maven release makes 3 commits (at least in mercurial):
Prepare the release
Make the tag of the release
Prepare for next development iteration
And sometimes if your project or release plugin´s configuration is not right configured, the release get stuck in the first commit. The problem is that sometimes it already updated the release into your sonatype server, so you have to delete this fake release from the sonatype server, configurate well your parent project´s pom.xml, compile the project, and release again.
This is how i looked while i delete my false release 1.0.0-alpha5 in the project bridje-parent:
Also delete the fake release located in its submodules. Remember to commit changes in your scm server before making a release.
Vote if it worked for you, it happened to me very seldom.

How do I configure CI hudson with PHPunit and how do I run phpunit using hudson?

I am getting following error mentioned below. Help is much needed for this...
kindly go through the errors.
Started by an SCM change
Updating https://suppliesguys.unfuddle.com/svn/suppliesguys_frontend2/Frontend-Texity/src
U sites\all\modules\print\print_pdf\print_pdf.pages.inc
At revision 1134
[workspace] $ sh -xe C:\WINDOWS\TEMP\hudson6292587174545072503.sh
The system cannot find the file specified
FATAL: command execution failed
java.io.IOException: Cannot run program "sh" (in directory "E:\Projects\Hudson\.hudson\jobs\TSG\workspace"): CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(Unknown Source)
at hudson.Proc$LocalProc.<init>(Proc.java:149)
at hudson.Proc$LocalProc.<init>(Proc.java:121)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:636)
at hudson.Launcher$ProcStarter.start(Launcher.java:271)
at hudson.Launcher$ProcStarter.join(Launcher.java:278)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:83)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:58)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:584)
at hudson.model.Build$RunnerImpl.build(Build.java:174)
at hudson.model.Build$RunnerImpl.doRun(Build.java:138)
at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:416)
at hudson.model.Run.run(Run.java:1244)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:122)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
... 17 more
Publishing Javadoc
Publishing Clover coverage report...
No Clover report will be published due to a Build Failure
[xUnit] Starting to record.
[xUnit] [PHPUnit] - Use the embedded style sheet.
[xUnit] [ERROR] - No test report file(s) were found with the pattern 'build/logs/phpunit.xml' relative to 'E:\Projects\Hudson\.hudson\jobs\TSG\workspace' for the testing framework 'PHPUnit'. Did you enter a pattern relative to the correct directory? Did you generate the result report(s) for 'PHPUnit'?
[xUnit] Stopping recording.
Finished: FAILURE
It looks like you are using the "Execute shell" build step on a windows system instead of the "Execute Windows batch command" build step. Windows doesn't normally have 'sh', so the former won't work.
Looks like you have a couple of problems:
FATAL: command execution failed java.io.IOException: Cannot run program "sh" (in directory "E:\Projects\Hudson.hudson\jobs\TSG\workspace"):
The user that's running the Hudson job doesn't have the "sh" command in its path, so it can't run shell scripts. Adding /bin to the $PATH of the Hudson user should fix this.
[xUnit] [ERROR] - No test report file(s) were found with the pattern 'build/logs/phpunit.xml' relative to 'E:\Projects\Hudson.hudson\jobs\TSG\workspace' for the testing framework 'PHPUnit'.
This is probably a result of the previous error; the build just didn't get far enough to run the PHPUnit tests.
'sh' is for linux implementations. Both '.exe' and 'bat' files are used in windows. Are you trying to setup and run Hudson on windows or linux?

maven-release-plugin: Perform fails with 'working directory "...workspace\target\checkout\workspace" does not exist!'

I have maven project that fails when release:perform is called, though release;prepare works as expected.
I have found the bug report (below) which certainly seems to resemble the issue I have but not entirely sure I understand the problem:
MRELEASE516
The last few lines of output I get:
[INFO] Executing: cmd.exe /X /C "p4 -d E:\hudson\jobs\myHudsonJob\workspace\target\checkout -p 1.1.1.1:1111: client -d myProjectWorkspace-MavenSCM-E:\hudson\jobs\myHudsonJob\workspace\target\checkout"
[INFO] Executing goals 'deploy'...
[WARNING] Base directory is a file. Using base directory as POM location.
[WARNING] Maven will be executed in interactive mode, but no input stream has been configured for this MavenInvoker instance.
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error executing Maven.
Working directory "E:\hudson\jobs\myHudsonJob\workspace\target\checkout\workspace" does not exist!
From reading the bug report the possible cause of the error is related to my modules' structure, I've tried to outline it below:
/workspace
|
|+ pom.xml (root pom whose parent is the build pom,
| calling release:perform on this pom)
| [Modules: moduleA and moduleB]
|
|- moduleA
|+ pom.xml (parent is also build pom)
|+ build/pom.xml (the build pom - no custom parent)
|- moduleB
|+ pom.xml (parent is build pom)
It seems that the root pom should be in some common directory inside 'workspace' from the error but tried that and doesn't work, nor make sense as to why I need it.
What does the warning Base directory is a file want me to do instead?! It then figures that the base directory is workspace which then means the working directory is not found...any ideas?
Thanks in advance.
EDIT:
Having checked the SCM configuration it all looks ok to me...in each module and the root pom I have:
<scm>
<connection>
scm:perforce:1.1.1.1:1111://rootToDirectoryContainingRelevantPom
</connection>
<developerConnection>
scm:perforce:1.1.1.1:1111://rootToDirectoryContainingRelevantPom
</developerConnection>
</scm>
EDIT 2:
Maybe I have hit MRELEASE-261?
I got this working by using a newer version of the release plugin. The Maven super pom has a dependency on v2.0 of the release plugin defined. If you don't override this then that the version will be used.
You can specify a newer version when you run the plugin
mvn org.apache.maven.plugins:maven-release-plugin:2.2.1:perform
Or you can override the dependency version in your pom
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.2.1</version>
</plugin>
I'm not sure you're facing MRELEASE-516 (which is about release:prepare). However, I wonder if you have correct <scm> informations in each POM. Can you confirm this?
Working directory "E:\hudson\jobs\myHudsonJob\workspace\target\checkout\workspace" does not exist!
I just saw the above line in your log. It looks like you have some screwy path setting somewhere. Do you overwrite the Workspace somewhere? Check your configuration and try to eliminate as much as possible the optional settings.
In my case the same symptoms turned out to be a result of a bug in maven-release-plugin:2.2.1. See MRELEASE-705.
So to get rid of the error, I've got to put this into the parent pom:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.0</version>
</plugin>
</plugins>
</build>
This error was occurring for us
Working directory E:\Data\myproject\target\checkout does not exist!
We're in the middle of a large transition of server tools and maven's release:prepare appeared to be failing silently, claiming the tags and version number changes had been pushed without error. However, after some research, these things had only been committed to the local git repository, not pushed - even though the release:prepare was executing commands to perform a push but never reported a failure -- even with the maven -e and -X command line parameters.
We're using Maven 3.3.9, maven release plugin 2.5.3, and git client 2.9.2.
Our end solution was to add a (or correct the, as your case may be) definition in maven's ~\.m2\settings.xml file for our git server (origin master) including username and password with privileges for pushing tags (as well as pushing to master). The id in the server definition for the git server needed to be the git server's hostname:
<servers>
<server>
<id>git-server</id>
<username>dan</username>
<password>changeit</password>
</server>
<servers>
With this update, the tag completes on the server and the checkout occurred successfully.