Reputation: 3333
I'm trying to get the maven release plugin working, integrating with Perforce. I finally got somewhere yesterday and managed to run:
mvn release:prepare
and was asked to specify a lot of versions and new working snapshots. I specified the version "0.1" (without the quotes) as the release version for all the sub-projects, and set the working snapshot to "1.0-SNAPSHOT" (same as before), as I was just testing the plugin and the integration with Perforce, rather than actually trying to build a release. However, after entering the information I got the following error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.3.1:prepare (default-cli) on project myproject: Execution default-cli of goal org.apache.maven.plugins:maven-release-plugin:2.3.1:prepare failed: The data "0.1" is not legal for a JDOM character content: 0x1b is not a legal XML character. -> [Help 1]
(I'm not 100% sure that was the exact error I got)
But now, everytime I run mvn release:prepare
, I get that same error (definitely the one above), without getting a chance to re-supply versions or working snapshot names.
Is the version "0.1" not valid, or have I somehow managed to enter an escape character ("0x1b") in one of the values, or is there something wrong somewhere else?
I also can't find where the values I entered have gone. How would I be able to set them again, or start the prepare from scratch inputing new values?
Thank you in advance to anyone having a look at this.
EDIT:
I've found an answer to the latter part, that is, how to reset the values. If I run
mvn release:prepare -Dresume=false
I get to enter the values again.
(And as @tom has mentioned in an answer already, I can run mvn release:rollback
to get rid of the ones that are there. However, this doesn't seem to work probably because the prepare failed.)
This time I entered the default values, but I've noticed that my problems are a lot deeper than that, and I probably haven't set up the Perforce integration properly. I get this INFO output:
No password found, proceeding without it.
Even though I've set it up as:
<server>
<id>ip-of-perforce-server</id>
<username>my-perforce-username</username>
<password>***************</password>
</server>
in my settings.xml. I've only seen it setup in examples in the pom of the project, but it was mentioned that you can do it in the settings.xml and that seems to be the only thing that makes sense (as the pom would normally be in the SCM). I can avoid getting this message if I specify the username and password as env vars (-Dusername=xxx, etc).
But I also get the error:
CommandLineException Exit code: 1 - Client 'PCNAME' unknown - use 'client' command to create it.
where PCNAME is the windows name of my desktop. I tried running:
p4 client
and that opens a file with the contents:
Client: PCNAME
Owner: my-perforce-username
Host: PCNAME
so why is it saying it's unknown/needs creating?
To answer myself, I just noticed that after running p4 client
it said Client PCNAME saved.
which I guess is why it was displayed :P So following the instruction in the error message was all I had to do.
Now I only have to problems:
If I run in cygwin I get the error Path 'D:\Server\pom.xml' is not under client's root '/cygdrive/d/Server'
which I guess has something to do with conflicts between unix and windows paths.
Apart from that I don't get any errors before after entering the versions where I get the following:
java.io.IOException: The filename, directory name, or volume label syntax is incorrect
at java.io.WinNTFileSystem.canonicalize0(Native Method)
at java.io.Win32FileSystem.canonicalize(Win32FileSystem.java:396)
at java.io.File.getCanonicalPath(File.java:559)
at org.apache.maven.scm.provider.perforce.command.edit.PerforceEditCommand.createCommandLine(PerforceEditCommand.java:109)
at org.apache.maven.scm.provider.perforce.command.edit.PerforceEditCommand.executeEditCommand(PerforceEditCommand.java:51)
at org.apache.maven.scm.command.edit.AbstractEditCommand.executeCommand(AbstractEditCommand.java:40)
at org.apache.maven.scm.command.AbstractCommand.execute(AbstractCommand.java:59)
at org.apache.maven.scm.provider.perforce.PerforceScmProvider.edit(PerforceScmProvider.java:210)
at org.apache.maven.scm.provider.AbstractScmProvider.edit(AbstractScmProvider.java:560)
at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.writePom(AbstractRewritePomsPhase.java:631)
at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.transformProject(AbstractRewritePomsPhase.java:231)
at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.transform(AbstractRewritePomsPhase.java:125)
at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.execute(AbstractRewritePomsPhase.java:110)
at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:234)
at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:169)
at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:146)
at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:107)
at org.apache.maven.plugins.release.PrepareReleaseMojo.prepareRelease(PrepareReleaseMojo.java:291)
at org.apache.maven.plugins.release.PrepareReleaseMojo.execute(PrepareReleaseMojo.java:247)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
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.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
[ERROR] CommandLineException Exit code: 1 - Usage: add/edit/delete [-c changelist#] [ -d -f -k -n -v ] [-t type] files...
Missing/wrong number of arguments.
Command line was:p4 -d D:\Server -p perforce-ip-and-port -u my-username -P my-password edit
org.codehaus.plexus.util.cli.CommandLineException: Exit code: 1 - Usage: add/edit/delete [-c changelist#] [ -d -f -k -n -v ] [-t type] files...
Missing/wrong number of arguments.
and the final Maven Build Failure error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.3.1:prepare (default-cli) on project project-name: Error writing POM: D:\Server\pom.xml (Access is denied) -> [Help 1]
(Note that this also happens when running the command on command line, where the error about the pom not being in the client's view does not appear)
Which seems to be my last remaining problem... getting there :)
Upvotes: 1
Views: 2418
Reputation: 2745
0.1 is definitely a legal version. The values you entered have gone into files at the same level as your pom.xml
file (Can't remember the name because they disappear after mvn release:perform
). To erase them you can use mvn release:rollback
Also when using multi-module projects be sure to use the 'autoVersionSubModules' flag:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>${maven.plugin.release.version}</version>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
</configuration>
</plugin>
This will also change the version of your modules.
EDIT: this answer only answers the part about the maven release plugin. Not the other parts of the question. The questioner has decided to ask new questions concerning the other parts of the question.
Upvotes: 2