views:

76

answers:

1

When i try to run a maven plugin, i found that the default classpath defined in expression $(project.compileClasspathElement) is too long. So, i just want to customize a shorter classpath for this plugin. The default configuration is as follows:

<plugin>
<groupId>org.datanucleus</groupId>
<artifactId>maven-datanucleus-plugin</artifactId>
<version>2.0.1</version>
<configuration>
    ...<classpathElements>${project.compileClasspathElements}</classpathElements>
</configuration>

and the value of classpathElements should be a String List. May i solve this problem? and how? thx!

A: 

I'm not 100% sure of the feasibility but to strictly answer your question, I think that the "right" way to do what you want would be to inject the ${project.compileClasspathElements} in a custom plugin, to filter its content and to make the customized classpath available under a new property that you could then use in your pom.xml and pass to the datanucleus plugin (setting a property of type List is the part I'm not sure).

But this sounds like an ugly workaround and if there is a problem with the datanucleus plugin (you didn't say what the problem is exactly), fixing the datanucleus plugin seems cleaner and won't take much more time than writing a plugin to workaround the problem. At least, if there is problem, raise an issue.

Pascal Thivent
During the execution of datanucleus plugin, It calls a command line that contains a long classpath. Sometimes this command line exceeds the maximum length 8k in Windows platform, and cause an exception. If there isn't any good workaround, i have to modify the plugin directly :(
zbdiablo
@zbdiablo Ok, I see. I think that modifying the plugin is the best option then (and it won't be that complicated).
Pascal Thivent