Issue Details (XML | Word | Printable)

Key: SUREFIRE-118
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Unassigned
Reporter: Jesper Zedlitz
Votes: 6
Watchers: 6
Operations

If you were logged in you would be able to see more operations.
Maven Surefire

Cannot override read-only parameter: classpathElements

Created: 08/Feb/06 06:45 AM   Updated: 23/Nov/07 08:04 PM
Component/s: None
Affects Version/s: 1.5.2 (2.1.2 plugin), 2.0 (2.2 plugin)
Fix Version/s: 2.4

Time Tracking:
Not Specified

File Attachments: 1. Text File additionalClasspaths.patch (1 kB)

Issue Links:
Duplicate
 

Patch Submitted: Yes


 Description  « Hide
When calling "mvn site" on a multi-module project the goal "surefire:test" fails for the second project:
Error configuring: org.apache.maven.plugins:maven-surefire-plugin. Reason: ERROR: Cannot override read-only parameter: classpathElements in goal: surefire:test

"mvn test" works and runs the tests on all modules.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Jean-Laurent de Morlhon added a comment - 16/Feb/06 07:05 AM
this is still happening with a fresh build of the plugin with svn at revision 1496

Brett Porter added a comment - 04/Mar/06 12:11 AM
what part of the site is failing? surefire-report, or cobertura, or something else?

David J. M. Karlsen added a comment - 26/Jul/06 03:34 PM
And what are your effective <surefire> settings for each artifact.
The variable is readonly, and the configuration may be errorneous?

Zarar Siddiqi added a comment - 27/Sep/06 03:10 PM
OK, I'm trying to run StrutsTestCase with Maven 2.x and need the web.xml and struts-config.xml to be in the classpath, which they are not by default.

So, I have the following configuration for the surefire plugin:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.2</version>
<configuration>
<classpathElements>
<classpathElement>target/${project.artifactId}-${project.version}</classpathElement>
</classpathElements>
</configuration>
</plugin>

And this expectedly yields:

Error configuring: org.apache.maven.plugins:maven-surefire-plugin. Reason: ERROR: Cannot override read-only parameter: classpathElements in goal: surefire:test

The reason this is expected is because an explanation is provided here:

http://www.nabble.com/testing-webapp-with-surefire-tf519140.html#a1403158

Brett Porter has recommended requesting another element called additionalClasspathElements to be added which would not be read-only and thus allow for additional classpath elements to be added.

I tried that using the following but it didn't get me anywhere.

<additionalClasspathElements>
<classpathElement>target/${project.artifactId}-${project.version}</classpathElement>
</additionalClasspathElements>

Any ideas?


Zarar Siddiqi added a comment - 27/Sep/06 10:26 PM
I've created a patch against revision 450675 which fixes this issue and allows you to specify additional classpaths:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<additionalClasspathElements>
<additionalClasspathElement>path/to/additional/resources</additionalClasspathElement>
</additionalClasspathElements>
</configuration>
</plugin>

This patch does pretty much the same thing as the one supplied in MSUREFIRE-153 but I can't understand why that one hasn't been applied.

I'm using this for now.


Peter Anning added a comment - 14/Aug/07 10:59 PM
I don't want to patch core maven I've done this before and it leads to a maintenance headache. For now I am running Junit via the ant plugin but this is not the point of maven. Please can we get this into the core asap.

Cheers
Peter


Dan Fabulich added a comment - 23/Nov/07 08:04 PM
Fixed and integration tested in revision 597783.