Maven: compile OK, package OK, compile + package fails - maven

I have a desktop Java project using Dagger2 and building with Maven. I can't run compile and package sequentially. This works:
$ mvn clean
$ mvn compile
And this works, producing an executable jar that runs without error:
$ mvn clean
$ mvn package
But this fails:
$ mvn clean
$ mvn compile
$ mvn package
When package gets to the module that uses Dagger2, it outputs:
[INFO] Changes detected - recompiling the module!
The error from mvn -e package is:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project weapon: Compilation failure -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project weapon: Compilation failure
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
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:320)
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:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:915)
at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
The module has this dependency:
<dependency>
<groupId>com.google.dagger</groupId>
<artifactId>dagger</artifactId>
<version>2.1</version>
<scope>compile</scope>
</dependency>
The module uses compiler plugin version 3.3 like this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<dependencies>
<dependency>
<groupId>com.google.dagger</groupId>
<artifactId>dagger-compiler</artifactId>
<version>2.1</version>
</dependency>
</dependencies>
<configuration>
<source>1.7</source>
<target>1.7</target>
<forceJavacCompilerUse>true</forceJavacCompilerUse>
</configuration>
</plugin>
This is the only Dagger-related configuration. Why can't I run package after build?
Possibly related: I thought forceJavacCompilerUse was no longer needed, but without it, Dagger doesn't seem to run at all. I get an unknown symbol error on the generated component implementation (DaggerMyComponent).
Edit: This is the full output of mvn -e package, command prompt to command prompt:
kevin#aphrodite:~/Projects/IDEA/Dark Matter$ mvn -e package
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] parent
[INFO] weapon
[INFO] scripts
[INFO] assembly
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building parent 2.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building weapon 2.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.3:resources (default-resources) # weapon ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) # weapon ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 8 source files to /home/kevin/Projects/IDEA/Dark Matter/weapon/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] parent ............................................ SUCCESS [0.001s]
[INFO] weapon ............................................ FAILURE [1.641s]
[INFO] scripts ........................................... SKIPPED
[INFO] assembly .......................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.735s
[INFO] Finished at: Fri Mar 11 04:32:38 MST 2016
[INFO] Final Memory: 21M/173M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project weapon: Compilation failure -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project weapon: Compilation failure
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
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:320)
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:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:915)
at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
[ERROR]
[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/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :weapon
kevin#aphrodite:~/Projects/IDEA/Dark Matter$
Edit 2: I noticed that when I run package by itself after clean, it says it's compiling 6 sources. That's how many hand-written classes are in the project. When I run compile before package, the latter says it's compiling 8 sources. It looks like when dagger-compiler runs on a clean project, it silently generates and compiles its sources. Then package sees the new sources and tries to compile them. The mystery is why it fails. Running compile twice in a row fails in the same way.
Edit 3: I tried this answer, specifying dagger.internal.codegen.ComponentProcessor as the -processor argument. Now the first time I run compile, I see the two passes where it compiles 6 files and then 8 files:
[INFO] --- maven-compiler-plugin:3.3:compile (process-annotations) # weapon ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 6 source files to /home/kevin/Projects/IDEA/Dark Matter/weapon/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.3:resources (default-resources) # weapon ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) # weapon ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 8 source files to /home/kevin/Projects/IDEA/Dark Matter/weapon/target/classes
This is expected, and this compile succeeds. But then if I run package, or compile again, it fails the same as before.
The sources Dagger produces are in /target/generated-sources/annotations. I think I need to tell Maven to do something with that path, but I don't know what. It makes sense that compile detects source changes when it is run twice in a row, though I don't know why that leads to failure. Maybe I need to run the annotation processing step conditionally, but I don't know how to do that or what the condition should be.

I managed to reproduce your problem.
The key seems to be the maven-compiler-plugin:3.3
When I run with maven-compiler-plugin:3.1, the error does not manifest.

Related

Failed to execute goal org.apache.rat:apache-rat-plugin:0.10:check (check) on project maven: Too many files with unapproved license: 2 See RAT report

I am trying to compile some of the maven reversions project. Unfortunately, I am getting error:
Failed to execute goal org.apache.rat:apache-rat-plugin:0.10:check (check) on project maven: Too many files with unapproved license: 2 See RAT report
As someone suggest to skip the checking, so I am using the commands
mvn -X -Drat.skip=true compile
mvn -X -Drat.skip=true test-compile
I also tried
-Drat.numUnapprovedLicense=100
-Dlicense.skip=true
-Drat.ignoreErrors=true
Using the skip worked for few reversion but now I am still getting this error even with using the skip.
This is the stack-trace:
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] Apache Maven
[INFO] Maven Model
[INFO] Maven Artifact
[INFO] Maven Plugin API
[INFO] Maven Model Builder
[INFO] Maven Settings
[INFO] Maven Settings Builder
[INFO] Maven Repository Metadata Model
[INFO] Maven Aether Provider
[INFO] Maven Core
[INFO] Maven Compat
[INFO] Maven Embedder
[INFO] Apache Maven Distribution
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Apache Maven 3.2.4-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (enforce-bytecode-version) # maven ---
[INFO]
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (ban-known-bad-maven-versions) # maven ---
[INFO]
[INFO] --- apache-rat-plugin:0.10:check (check) # maven ---
[INFO] 63 implicit excludes (use -debug for more details).
[INFO] Exclude: src/test/resources*/**
[INFO] Exclude: src/test/projects/**
[INFO] Exclude: src/test/remote-repo/**
[INFO] Exclude: **/*.odg
[INFO] Exclude: bootstrap/**
[INFO] Exclude: README.bootstrap.txt
[INFO] Exclude: .repository/**
[INFO] Exclude: .maven/spy.log
[INFO] 12 resources included (use -debug for more details)
Warning: org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser: Property 'http://www.oracle.com/xml/jaxp/properties/entityExpansionLimit' is not recognized.
Compiler warnings:
WARNING: 'org.apache.xerces.jaxp.SAXParserImpl: Property 'http://javax.xml.XMLConstants/property/accessExternalDTD' is not recognized.'
Warning: org.apache.xerces.parsers.SAXParser: Feature 'http://javax.xml.XMLConstants/feature/secure-processing' is not recognized.
Warning: org.apache.xerces.parsers.SAXParser: Property 'http://javax.xml.XMLConstants/property/accessExternalDTD' is not recognized.
Warning: org.apache.xerces.parsers.SAXParser: Property 'http://www.oracle.com/xml/jaxp/properties/entityExpansionLimit' is not recognized.
[INFO] Rat check: Summary of files. Unapproved: 2 unknown: 2 generated: 0 approved: 6 licence.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Apache Maven ....................................... FAILURE [ 0.725 s]
[INFO] Maven Model ........................................ SKIPPED
[INFO] Maven Artifact ..................................... SKIPPED
[INFO] Maven Plugin API ................................... SKIPPED
[INFO] Maven Model Builder ................................ SKIPPED
[INFO] Maven Settings ..................................... SKIPPED
[INFO] Maven Settings Builder ............................. SKIPPED
[INFO] Maven Repository Metadata Model .................... SKIPPED
[INFO] Maven Aether Provider .............................. SKIPPED
[INFO] Maven Core ......................................... SKIPPED
[INFO] Maven Compat ....................................... SKIPPED
[INFO] Maven Embedder ..................................... SKIPPED
[INFO] Apache Maven Distribution .......................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.936 s
[INFO] Finished at: 2017-08-12T15:23:22-07:00
[INFO] Final Memory: 17M/277M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.rat:apache-rat-plugin:0.10:check (check) on project maven: Too many files with unapproved license: 2 See RAT report in: /tmp/12311_1502575092/target/rat.txt -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.rat:apache-rat-plugin:0.10:check (check) on project maven: Too many files with unapproved license: 2 See RAT report in: /tmp/12311_1502575092/target/rat.txt
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
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:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.rat.mp.RatCheckException: Too many files with unapproved license: 2 See RAT report in: /tmp/12311_1502575092/target/rat.txt
at org.apache.rat.mp.RatCheckMojo.check(RatCheckMojo.java:183)
at org.apache.rat.mp.RatCheckMojo.execute(RatCheckMojo.java:171)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
... 20 more
[ERROR]
[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/MojoFailureException
Any suggestion to solve this error.
Thank you
Below command worked in my case.
mvn clean install -Drat.numUnapprovedLicenses=100

Maven test error: javac: source release 1.8 requires target release 1.8 [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
If I run mvn -e test, I get the error:
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Skat09 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The artifact org.apache.commons:commons-io:jar:1.3.2 has been relocated to commons-io:commons-io:jar:1.3.2
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # Skat09 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 6 resources
[INFO] Copying 191 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) # Skat09 ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 64 source files to /home/buzz-dee/Workspace/skat09/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] javac: source release 1.8 requires target release 1.8
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.729 s
[INFO] Finished at: 2015-10-02T23:17:02+02:00
[INFO] Final Memory: 10M/298M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project Skat09: Compilation failure
[ERROR] javac: source release 1.8 requires target release 1.8
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project Skat09: Compilation failure
javac: source release 1.8 requires target release 1.8
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
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:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure
javac: source release 1.8 requires target release 1.8
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:911)
at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 20 more
[ERROR]
[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/MojoFailureException
This is my Maven pom.xml:
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<rules>
<requireJavaVersion>
<version>1.8</version>
</requireJavaVersion>
</rules>
<source>1.8</source>
<tagret>1.8</tagret>
</configuration>
</plugin>
</plugins>
The output from mvn -version:
Apache Maven 3.3.3 (NON-CANONICAL_2015-07-27T12:38:38_root; 2015-07-27T11:38:38+02:00)
Maven home: /opt/maven
Java version: 1.8.0_60, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-jdk/jre
Default locale: de_DE, platform encoding: UTF-8
OS name: "linux", version: "4.2.2-1-arch", arch: "amd64", family: "unix"
Java JDK (archlinux-java get) setting:
java-8-jdk
Java compiler version (javac -version):
javac 1.8.0_60
I also tried to add:
<verbose>true</verbose>
<fork>true</fork>
<executable>/usr/lib/jvm/java-8-jdk/bin/javac</executable>
<compilerVersion>1.8</compilerVersion>
to the configuration element of the maven-compiler-plugin in the POM.
What is problem for the above error and how can I solve it?
you made a typo: <tagret>1.8</tagret> should be <target>1.8</target>

Getting error while running mvn server

I convered a regular java project t maven using eclipse configure->Convert to MVN and also added all dependecies in POM related to google api. I am getting the below error constantly when iam using mvn jetty:run. please let me know how to resolve this.
[INFO] Building glass-qrlens 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-jetty-plugin:6.1.26:run (default-cli) > test-compile # glass-qrlens >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # glass-qrlens ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\sridharg\git\glass-qrlens\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # glass-qrlens ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # glass-qrlens ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\sridharg\git\glass-qrlens\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # glass-qrlens ---
[INFO] No sources to compile
[INFO]
[INFO] <<< maven-jetty-plugin:6.1.26:run (default-cli) < test-compile # glass-qrlens <<<
[INFO]
[INFO] --- maven-jetty-plugin:6.1.26:run (default-cli) # glass-qrlens ---
[INFO] Configuring Jetty for project: glass-qrlens
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.843 s
[INFO] Finished at: 2014-10-25T15:49:55-05:00
[INFO] Final Memory: 7M/18M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.mortbay.jetty:maven-jetty-plugin:6.1.26:run (default-cli) on project glass-qrlens: Webapp source directory C:\Users\sridharg\git\glass-
qrlens\src\main\webapp does not exist -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.mortbay.jetty:maven-jetty-plugin:6.1.26:run (default-cli) on project glass-qrlens: Weba
pp source directory C:\Users\sridharg\git\glass-qrlens\src\main\webapp does not exist
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
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:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Webapp source directory C:\Users\sridharg\git\glass-qrlens\src\main\webapp does not exist
at org.mortbay.jetty.plugin.AbstractJettyRunMojo.checkPomConfiguration(AbstractJettyRunMojo.java:228)
at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:395)
at org.mortbay.jetty.plugin.AbstractJettyRunMojo.execute(AbstractJettyRunMojo.java:210)
at org.mortbay.jetty.plugin.Jetty6RunMojo.execute(Jetty6RunMojo.java:184)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
[ERROR]
[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/MojoExecutionException
Thanks,
Sridhar G
Maven web projects will by default use the directory src/main/webapp for webresources.
The jetty-maven-plugin doesn't know that you are using a different directory and hence you are getting this error.
You can use something like
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.2.3.v20140905</version>
<configuration>
<webAppSourceDirectory>${project.basedir}/WebContent/</webAppSourceDirectory>
<configuration>
</plugin>
to make the jetty-maven-plugin use a different webapp directory.
Jetty is now an Eclipse project and I have used the same in the answer, but the old one which you are currently using does support the webAppSourceDirectory configuration.
Read more about at the Eclipse Documentation

Openfire APNS plugin issue

I need to integrate Apple Push Notification Service to Openfire.
For that I had followed openfire-apns-plugin. But when I am executing mvn clean install command (last step), I am getting error. So, because of that openfire-apns.jar is not created.Please help me to figure out this issue. Following log is generated after executing mvn clean install,
root#vps [~/openfire_src/openfire-apns-plugin]# mvn clean install
[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building APNS Service 1.0.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # apns ---
[INFO] Deleting /root/openfire_src/openfire-apns-plugin/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # apns ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /root/openfire_src/openfire-apns-plugin/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.0:compile (default-compile) # apns ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 4 source files to /root/openfire_src/openfire-apns-plugin/target/classes
[INFO]
[INFO] --- maven-openfire-plugin:1.0.2-SNAPSHOT:jspc (default-jspc) # apns ---
[INFO] Logging to org.slf4j.impl.SimpleLogger(org.mortbay.log) via org.mortbay.log.Slf4jLog
java.lang.NullPointerException: charsetName
at java.io.OutputStreamWriter.<init>(OutputStreamWriter.java:99)
at org.apache.jasper.compiler.JDTJavaCompiler.getJavaWriter(JDTJavaCompiler.java:120)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:146)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:362)
at org.apache.jasper.JspC.processFile(JspC.java:1137)
at org.apache.jasper.JspC.execute(JspC.java:1306)
at com.reucon.maven.plugin.openfire.jspc.JspcMojo.compile(JspcMojo.java:279)
at com.reucon.maven.plugin.openfire.jspc.JspcMojo.execute(JspcMojo.java:196)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
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:108)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.557 s
[INFO] Finished at: 2014-09-15T06:01:37-05:00
[INFO] Final Memory: 17M/98M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.reucon.maven.plugins:maven-openfire-plugin:1.0.2-SNAPSHOT:jspc (default-jspc) on project apns: Failure processing jsps -> [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/MojoFailureException

maven release:prepare IOException

I'm trying to get maven's release plugin working with Perforce. When I run:
mvn release:prepare -Dusername=PerforceUser -Dpassword=PerforcePassword
I get this output (with some IPs/username/passwords removed):
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order: [INFO]
[INFO] root-project
[INFO] project1
[INFO] project2
[INFO] project3
[INFO] project4
[INFO] project5
[INFO] project6
[INFO] project7
[INFO] project8
[INFO] project9
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building root-project 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-release-plugin:2.3.1:prepare (default-cli) # root-project ---
[INFO] Verifying that there are no local modifications...
[INFO] ignoring changes on: **\release.properties, **\pom.xml.next, **\pom.xml.releaseBackup, **\pom.xml.backup, **\pom.xml.bran
ch, **\pom.xml.tag
[ERROR] Path 'D:\Server\pom.xml' is not under client's root '/cygdrive/d/Server'.
[INFO] Checking dependencies and plugins for snapshots ...
What is the release version for "root-project"? (com.company:root-project) 1.0: :
What is SCM release tag or label for "root-project"? (com.company:root-project) root-project-1.0: :
What is the new development version for "root-project"? (com.company:root-project) 1.1-SNAPSHOT: :
[INFO] Transforming 'root-project'...
[INFO] Updating project8 to 1.0
[INFO] Updating project4 to 1.0
[INFO] Updating project1 to 1.0
[INFO] Updating project3 to 1.0
[INFO] Updating project6 to 1.0
[INFO] Updating project7 to 1.0
[INFO] Updating project9 to 1.0
[INFO] Updating project5 to 1.0
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 *The-IP-of-Perforce* -u *PerforceUser* -P *PerforcePassword* 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.
Command line was:p4 -d D:\Server -p *The-IP-of-Perforce* -u *PerforceUser* -P *PerforcePassword* edit
at org.apache.maven.scm.provider.perforce.command.edit.PerforceEditCommand.executeEditCommand(PerforceEditCommand.java:71)
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)
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] root-project ........................................ FAILURE [22.348s]
[INFO] project1 ............................................ SKIPPED
[INFO] project2 ............................................ SKIPPED
[INFO] project3 ............................................ SKIPPED
[INFO] project4 ............................................ SKIPPED
[INFO] project5 ............................................ SKIPPED
[INFO] project6 ............................................ SKIPPED
[INFO] project7 ............................................ SKIPPED
[INFO] project8 ............................................ SKIPPED
[INFO] project9 ............................................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 22.967s
[INFO] Finished at: Tue Jun 12 15:41:53 BST 2012
[INFO] Final Memory: 8M/154M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.3.1:prepare (default-cli) on project root-project: Error writing POM: D:\Server\pom.xml (Access is denied) -> [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/MojoExecutionException
This happens both when I run it in cygwin and when I run it in a normal native Windows command prompt.
Before I got this far in the setup, I was sure it managed to write the versions to the pom at least once, but now it doesn't.
Looking at the maven scm provider for perforce source code I can see that on line 93 it creates the basic p4 command line
Commandline command = PerforceScmProvider.createP4Command( repo, workingDirectory );
then on line 95 it adds the edit
command.createArg().setValue( "edit" );
and then inside the try-catch it adds the files. But line 109
String canfile = file.getCanonicalPath();
is throwing the IOException seen above causing the stacktrace to be printed and this is why the file(s) don't get added and the execution of the p4 command fails (which in turn causes the "Access is denied" because it's failing to checkout the file (which is therefore read only).
EDIT:
The reason it throws the IOException is that when it creates the file on line 103:
File file = new File( workingDirectory, fs.get( i ).getPath() );
the fs.get( i ).getPath() returns an absolute path, so file ends up looking like
D:\Server\D:\Server\pom.xml (in my case)
and this is obviously broken.
I've changed the line (and a similar line in PerforceCheckInCommand.java locally to:
File file = null;
if(fs.get( i ).isAbsolute()) file = new File( fs.get( i ).getPath() );
else file = new File( workingDirectory, fs.get( i ).getPath() );
and reinstalled the plugin and now it all works. So the problem is a bug in the plugin causing my particular setup to fail. I've submitted a bug report, so hopefully no one else will experience this, but if they do, download the plugin src, make those two changes and re-install it (mvn install), and it should work.

Resources