jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Maven Surefire
  • SUREFIRE-118

Cannot override read-only parameter: classpathElements

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.5.2 (2.1.2 plugin), 2.0 (2.2 plugin)
  • Fix Version/s: 2.4
  • Component/s: None
  • Labels:
    None
  • Patch Submitted:
    Yes

Description

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.

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. Text File
    additionalClasspaths.patch
    27/Sep/06 10:26 PM
    1 kB
    Zarar Siddiqi

Issue Links

is duplicated by

Improvement - An improvement or enhancement to an existing feature or task. SUREFIRE-180 Ability to add additions to classpath

  • Major - Major loss of function.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Jean-Laurent de Morlhon added a comment - 16/Feb/06 7:05 AM

this is still happening with a fresh build of the plugin with svn at revision 1496

Show
Jean-Laurent de Morlhon added a comment - 16/Feb/06 7:05 AM this is still happening with a fresh build of the plugin with svn at revision 1496
Hide
Permalink
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?

Show
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?
Hide
Permalink
David J. M. Karlsen added a comment - 26/Jul/06 3:34 PM

And what are your effective <surefire> settings for each artifact.
The variable is readonly, and the configuration may be errorneous?

Show
David J. M. Karlsen added a comment - 26/Jul/06 3:34 PM And what are your effective <surefire> settings for each artifact. The variable is readonly, and the configuration may be errorneous?
Hide
Permalink
Zarar Siddiqi added a comment - 27/Sep/06 3: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?

Show
Zarar Siddiqi added a comment - 27/Sep/06 3: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?
Hide
Permalink
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.

Show
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.
Hide
Permalink
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

Show
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
Hide
Permalink
Dan Fabulich added a comment - 23/Nov/07 8:04 PM

Fixed and integration tested in revision 597783.

Show
Dan Fabulich added a comment - 23/Nov/07 8:04 PM Fixed and integration tested in revision 597783.
Hide
Permalink
David Hoffer added a comment - 03/Aug/09 4:14 PM

Is it possible to specify the classpath load order of existing dependencies?

I have a case where maven installs & deploys work find but site-deploy does not. The reason is the the order of the class path entries in the surefirebooter jar is different. I need to make sure that an artifact with overrides is loaded first. I don't need to add additional cp elements just specify order.

Can this be done somehow?

-Dave

Show
David Hoffer added a comment - 03/Aug/09 4:14 PM Is it possible to specify the classpath load order of existing dependencies? I have a case where maven installs & deploys work find but site-deploy does not. The reason is the the order of the class path entries in the surefirebooter jar is different. I need to make sure that an artifact with overrides is loaded first. I don't need to add additional cp elements just specify order. Can this be done somehow? -Dave
Hide
Permalink
lisak added a comment - 05/Nov/11 5:05 PM

Guys I would need to add 200 jars on classpath to boot up Liferay portal :

<additionalClasspathElements>
	<additionalClasspathElement>
		/opt/liferay/portal/lib/development/*
	</additionalClasspathElement>
	<additionalClasspathElement>
		/opt/liferay/portal/lib/global/*
	</additionalClasspathElement>
	<additionalClasspathElement>
		/opt/liferay/portal/lib/portal/*
	</additionalClasspathElement>
</additionalClasspathElements>

but it doesn't work. Neither *.jar wildcard ... Although

/opt/liferay/portal/lib/portal/c3p0.jar

works.

I have really hard times to manage to debug surefire plugin. I can debug all other maven plugins remotely via Eclipse, but a breakpoint in AbstractSurefireMojo is just not triggered...

Show
lisak added a comment - 05/Nov/11 5:05 PM Guys I would need to add 200 jars on classpath to boot up Liferay portal :
<additionalClasspathElements>
	<additionalClasspathElement>
		/opt/liferay/portal/lib/development/*
	</additionalClasspathElement>
	<additionalClasspathElement>
		/opt/liferay/portal/lib/global/*
	</additionalClasspathElement>
	<additionalClasspathElement>
		/opt/liferay/portal/lib/portal/*
	</additionalClasspathElement>
</additionalClasspathElements>
but it doesn't work. Neither *.jar wildcard ... Although
/opt/liferay/portal/lib/portal/c3p0.jar
works. I have really hard times to manage to debug surefire plugin. I can debug all other maven plugins remotely via Eclipse, but a breakpoint in AbstractSurefireMojo is just not triggered...

People

  • Assignee:
    Unassigned
    Reporter:
    Jesper Zedlitz
Vote (6)
Watch (6)

Dates

  • Created:
    08/Feb/06 6:45 AM
    Updated:
    05/Nov/11 5:05 PM
    Resolved:
    23/Nov/07 8:04 PM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.