Is there any way how to pass classpath entry to the plugin? Something like this: <systemProperties> <maven.class.path>${classpathElements}</maven.class.path> </systemProperties>
in the code I can easily get this property using: String mavenClassPath = System.getProperty("maven.class.path");
Thanks. Peter
Comment #1
Posted on Sep 12, 2011 by Quick RabbitHi
The plugin use by default the $classpathElements .... below a snippet from AnnotationProcessor code
/** * project classpath * * @parameter expression = "${project.compileClasspathElements}" * @required * @readonly */ private List classpathElements;
Comment #2
Posted on Sep 12, 2011 by Happy RhinoThanks for the reply.
Yes, but ${project.compileClasspathElements} is List and system properties are String based values, so maven cannot cast List to the String and fails.
Comment #3
Posted on Sep 12, 2011 by Quick RabbitHi
the last release 2.0.4 support the tag
see documentation [http://maven-annotation-plugin.googlecode.com/svn/docs/usage.html]
It's also supported options that could be get from processor in the following standard way:
java.util.Map optionMap = processingEnv.getOptions();
Comment #4
Posted on Sep 12, 2011 by Happy RhinoHi,
yes, i've tried options too, but the result is almost the same:
1) If I use ${project.compileClasspathElements} the ClassCastException is thrown
Configuration: ${project.compileClasspathElements}
Result: [INFO] Adding compiler arg: -encoding [INFO] Adding compiler arg: utf-8 [INFO] Adding compiler arg: -nowarn java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.lang.String at org.bsc.maven.plugin.processor.AbstractAnnotationProcessorMojo.addCompilerArguments(AbstractAnnotationProcessorMojo.jav a:385) at org.bsc.maven.plugin.processor.AbstractAnnotationProcessorMojo.executeWithExceptionsHandled(AbstractAnnotationProcessor Mojo.java:257) at org.bsc.maven.plugin.processor.AbstractAnnotationProcessorMojo.execute(AbstractAnnotationProcessorMojo.java:197) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
2) Using ${project.classpathElements} has no effect:
Configuration: ${project.classpathElements}
3) The "old way" leads to the strange results:
Configuration: -Aclasspath=${project.compileClasspathElements}
Result: ... [INFO] javac option: utf-8 [INFO] javac option: -nowarn [INFO] javac option: -Aclasspath=[c:\devel\seges\acris-os\sesam\branches\1.1.0\sesam-annotation-apis\sesam-selenium-api\target\cla sses, [INFO] javac option: c:\m2\sk\seges\sesam\sesam-configuration-api\1.1.4-SNAPSHOT\sesam-configuration-api-1.1.4-SNAPSHOT.jar, [INFO] javac option: c:\m2\sk\seges\sesam\sesam-core\1.1.4-SNAPSHOT\sesam-core-1.1.4-SNAPSHOT.jar, .... [INFO] javac option: c:\m2\javax\mail\mail\1.4.1\mail-1.4.1.jar, [INFO] javac option: c:\m2\javax\activation\activation\1.1\activation-1.1.jar] [INFO] javac option: -d [INFO] javac option: c:\devel\seges\acris-os\sesam\branches\1.1.0\sesam-annotation-apis\sesam-selenium-api\target\classes [INFO] javac option: -s [INFO] javac option: c:\devel\seges\acris-os\sesam\branches\1.1.0\sesam-annotation-apis\sesam-selenium-api\target\generated java.lang.IllegalArgumentException: invalid flag: c:\m2\sk\seges\sesam\sesam-configuration-api\1.1.4-SNAPSHOT\sesam-configuration- api-1.1.4-SNAPSHOT.jar, at com.sun.tools.javac.api.JavacTool.processOptions(JavacTool.java:236) at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:207) at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:53) at org.bsc.maven.plugin.processor.AbstractAnnotationProcessorMojo.executeWithExceptionsHandled(AbstractAnnotationProcessor Mojo.java:337) ...
Thank you in advance
Comment #5
Posted on Sep 12, 2011 by Quick RabbitActually the plugin (and the java processor itself) are designed to have parameters as string
So, unless to implement a specific customization, actually i don't see any solution
Comment #6
Posted on Sep 12, 2011 by Quick RabbitI'm planning to allow to pass, trought options, not just string but object and retrieve value using .toString()
This will solve issue
Stay tune for new release
Comment #7
Posted on Sep 13, 2011 by Happy RhinoGreat idea, thank you for solving this issue
Comment #8
Posted on Sep 13, 2011 by Quick RabbitHi
i've release a new SNAPSHOT ( 2.0.5-SNAPSHOT ) with a fix for your problem
FYI: repo is https://oss.sonatype.org/content/repositories/snapshots
Use :
${project.compileClasspathElements}
and let me know
Comment #9
Posted on Sep 13, 2011 by Happy RhinoYou are my this week's hero :-) Thank you, works as expected.
Comment #10
Posted on Sep 13, 2011 by Quick Rabbitglad to hear
i'll arrange a new release soon
Status: Fixed
Labels:
Type-Defect
Priority-Medium