[Surefire2.3] Resources classpath problem
Hello, We have a few problems with the classpath used by surefire. Some tests fail randomly due to the order of the classpath managed by Surefire. During the execution of unit tests, it seems that the classpath used by maven differs from the classpath used by my IDE (IntelliJ). In IntelliJ, resources are loaded with the following order : /target/test-classes /target/classes .../aLib.jar .../anotherLib.jar ... But, by using maven2, the order is : ... .../aLib.jar /target/test-classes /target/classes .../anotherLib.jar ... Our projects use Surefire2.3. Is it possible to patch surefire to get a correct classpath (such as IntelliJ) ? Has this bug been fixed with maven2.0.8 ? Thanks. Regards, Alexandre Bunod and Olivier Catteau
Test : preventing expected stack trace in the console
Hi, I have a lot of unit tests in my app. When the tests runs, I see numerous expected stack traces logged in the console and at the end I get a normal Build Successful (but the first impression is that it failed). I would like that these expected stack traces don't appear in the console (in maven1, these traces wasn't logged). Is it possible ? Thanks. Olivier
Release plugin : same version of modules
Hi, I've got a multi-modules application. I'd like that the different modules have the same version so I have fixed the same version in every pom.xml. But when I use the release plugin, I need to enter the version of every modules. Is it possible to enter a single version for every modules ? or do I need to customize my own release plugin ? Thanks. Olivier
Re: Executin a plugin goal from another plugin
Hi, I think there is no way to execute another plugin from your own plugin by using @execute. But you would have to use the execute method of the MavenEmbedder class in your own mojo. It must be something like this : /** * The reactor projects in a multi-module build. * * @parameter expression=${reactorProjects} * @required * @readonly */ private List reactorProjects; ... MavenEmbedder embedder = new MavenEmbedder(); embedder.setClassLoader(Thread.currentThread().getContextClassLoader()); embedder.start(); embedder.execute(reactorProjects, Collections.singletonList(assembly:assembly), new DefaultEventMonitor(new PlexusLoggerAdapter( embedder.getLogger())), new ConsoleDownloadMonitor(), null, ((MavenProject)projects.get(0)) .getBasedir()); I hope, it helps you. Olivier 2006/9/19, Mikko [EMAIL PROTECTED]: Hi, Is there a way to run another plugin goal from my own plugin by using the @execute goal= tag in my plugin. I would like to be able to run the assembly:assembly goal from my plugin. When I use @execute goal=assembly:assembly, the build process says that it can not be found. br, Mikko -- View this message in context: http://www.nabble.com/Executin-a-plugin-goal-from-another-plugin-tf2297411.html#a6383118 Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Last deployed Snapshot not retrieve from another machine
Hi, I've got a strange problem and I'd like to know if it's a known bug or if I made a mistake when I configure my settings.xml or when I configure proximity. In fact, if I deploy a library in snapshot with maven2 and if I use this library in a project on the same machine, then I use my new snapshot library. So, in this case, it works correctly. But if on another machine, I try to compile the same project, the snapshot deployed is not downloaded (metadata files seems to be updated but not jar files). Instead of this, the older snapshot (from the local repository) is used. Has anyone has got the same problem ? Here is a part of my settings.xml : settings xmlns=http://maven.apache.org/POM/4.0.0; xmlns:xsi= http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd; ... localRepositoryC:/Dev/tools/maven/local/maven2/localRepository mirrors mirror idcorp-central-mirror/id namecentral (CORP mirror)/name url http://martinique:8181/proximity/repository/url mirrorOfcentral/mirrorOf /mirror mirror idcorp-central-snapshot-mirror/id namecentral snapshot (CORP mirror)/name urlhttp://martinique:8181/proximity/repository/url mirrorOf apache.snapshots/mirrorOf /mirror mirror idcorp-codehaus-mirror/id namecodehaus (CORP mirror)/name url http://martinique:8181/proximity/repository/url mirrorOfcodehaus/mirrorOf /mirror mirror idcorp-codehaus-snapshot-mirror/id namecodehaus snapshot (CORP mirror)/name urlhttp://martinique:8181/proximity/repository /url mirrorOfcodehaus.snapshots/mirrorOf /mirror /mirrors profiles profile idcorp-repositories/id repositories repository idcorp-repository-maven1/id nameRepository CORP (maven1)/name urlfile:Z:/maven/repository/url layoutlegacy/layout releases enabledtrue/enabled /releases snapshots enabledfalse/enabled /snapshots /repository repository idcorp-repository-maven1-snapshot/id nameRepository CORP (maven1-snapshot)/name urlfile:Z:/maven/repository/url layoutlegacy/layout releases enabledfalse/enabled /releases snapshots enabledtrue/enabled updatePolicyalways/updatePolicy /snapshots /repository repository idcorp-repository-snapshot/id nameRepository CORP snapshot/name urlhttp://martinique:8181/proximity/repository/url releases enabledfalse/enabled /releases snapshots enabledtrue/enabled updatePolicyalways/updatePolicy /snapshots /repository /repositories pluginRepositories pluginRepository idcorp-repository-plugin/id nameRepository CORP plugin/name urlhttp://martinique:8181/proximity/repository/url /pluginRepository pluginRepository idcorp-repository-maven1/id nameRepository CORP (maven1)/name urlfile:Z:/maven/repository/url layoutlegacy/layout releases enabledtrue/enabled /releases snapshots enabledfalse/enabled /snapshots /pluginRepository pluginRepository idcorp-repository-maven1-snapshot/id nameRepository CORP (maven1-snapshot)/name urlfile:Z:/maven/repository/url layoutlegacy/layout releases enabledfalse/enabled /releases snapshots enabledtrue/enabled updatePolicyalways/updatePolicy /snapshots /pluginRepository /pluginRepositories /profile ... /profiles ... activeProfiles activeProfilecorp-repositories/activeProfile /activeProfiles ... /settings
ideauidesigner-maven-plugin failed with JDK1.5
Hi, I use ideauidesigner-maven-plugin, I don't understand that the compilation of IDEA forms doesn't work when I try to compile with JDK1.5 (it works with JDK1.4). Has anyone had the same problem ? It seems that it comes from the bcel-5.1.jar downloaded from the remote repository. To overcome this problem, I have deployed the bcel.jar from IntelliJ IDEA 5.1.2 to my continuum repository. Then I have configured my dependencies such like that : dependency groupIdcom.intellij/groupId artifactIdforms_rt/artifactId version5.1/version exclusions exclusion groupIdbcel/groupId artifactIdbcel/artifactId /exclusion /exclusions /dependency and I've configured the ideauidesigner-maven-plugin such like that : plugin groupIdorg.codehaus.mojo/groupId artifactIdideauidesigner-maven-plugin/artifactId dependencies dependency groupIdbcel/groupId artifactIdbcel/artifactId version5.1-home/version /dependency /dependencies executions execution phasecompile/phase goals goaljavac2/goal /goals /execution /executions configuration forktrue/fork debugoff/debug verbosetrue/verbose failOnErrortrue/failOnError /configuration /plugin Regards, Olivier
Classloader problem ?
Hi, I've got a problem when I try to use UISpec4J for unit testing Swing based applications. Iv'e got a test class that extends UISpecTestCase. In IntelliJ, my test works witout any problem. But, when I try to run my test by using Maven2, it throws an exception. ### [INFO] [surefire:test] [INFO] Surefire report directory: C:\DEV\projects\migration\agf-agent-bootstrap\target\surefire-reports org.apache.maven.surefire.booter.SurefireExecutionException: com.agf.workflow.gui.wizard.WizardWindowTest; nested exception is jav a.awt.AWTError: Toolkit not found: org.uispec4j.interception.toolkit.UISpecToolkit; nested exception is org.apache.maven.surefire. testset.TestSetFailedException: com.agf.workflow.gui.wizard.WizardWindowTest; nested exception is java.awt.AWTError: Toolkit not f ound: org.uispec4j.interception.toolkit.UISpecToolkit org.apache.maven.surefire.testset.TestSetFailedException: com.agf.workflow.gui.wizard.WizardWindowTest; nested exception is java.a wt.AWTError: Toolkit not found: org.uispec4j.interception.toolkit.UISpecToolkit java.awt.AWTError: Toolkit not found: org.uispec4j.interception.toolkit.UISpecToolkit at java.awt.Toolkit$2.run(Toolkit.java:828) at java.security.AccessController.doPrivileged(Native Method) at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:804) at javax.swing.UIManager.clinit(UIManager.java:313) at org.uispec4j.interception.ui.UISpecLF.init(UISpecLF.java:11) at org.uispec4j.UISpec4J.init(UISpec4J.java:21) at org.uispec4j.UISpecTestCase.clinit(UISpecTestCase.java:31) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance( NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance( DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:494) at junit.framework.TestSuite.createTest(TestSuite.java:131) at junit.framework.TestSuite.addTestMethod(TestSuite.java:114) at junit.framework.TestSuite.init(TestSuite.java:75) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance( NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance( DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:494) at org.apache.maven.surefire.junit.JUnitTestSet.constructTestObject( JUnitTestSet.java:148) at org.apache.maven.surefire.junit.JUnitTestSet.getTestCount( JUnitTestSet.java:244) at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.locateTestSets( AbstractDirectoryTestSuite.java:101) at org.apache.maven.surefire.Surefire.createSuiteFromDefinition( Surefire.java:147) at org.apache.maven.surefire.Surefire.run(Surefire.java:108) 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:585) at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess( SurefireBooter.java:225) at org.apache.maven.surefire.booter.SurefireBooter.main( SurefireBooter.java:747) ### It seems to be a problem of classloader that comes from UISpec4J. I don't know how it is managed by surefire. Perhaps it comes from this piece of code : ## private static void setAwtToolkitProperty() { try { Class.forName(WINDOWS_SYSTEM_DEFAULT_VALUE); awtToolkit = WINDOWS_SYSTEM_DEFAULT_VALUE; } catch (ClassNotFoundException e) { try { Class.forName(UNIX_SYSTEM_DEFAULT_VALUE); awtToolkit = UNIX_SYSTEM_DEFAULT_VALUE; } catch (ClassNotFoundException e1) { throw new AWTError(Unable to locate AWT Toolkit); } } } ## Has anyone have any idea about the source of my problem ? and how to resolve this problem ? Or can anyone explain how surfire manage classloader ? Thanks. Olivier
Re: Classloader problem ?
Hi, I try to have a simpler example to test ClassLoader when I run my tests with M2. (in this example, I don't use UISpec4J) With this example, I always have a kind of class not found exception. Here is a part of my POM file : plugin groupId org.apache.maven.plugins /groupId artifactIdmaven-surefire-plugin/artifactId configuration forkModeonce/forkMode configuration childDelegationtrue/childDelegation /configuration /configuration /plugin Here is the method of test class that I used : public void testClassLoader() throws Exception { System.setProperty(awt.toolkit, MyToolkit.class.getName()); Toolkit defaultToolkit = Toolkit.getDefaultToolkit(); assertNotNull(defaultToolkit); System.out.println (defaultToolkit.getClass()= + defaultToolkit.getClass()); } The result by using IDEA IntelliJ : defaultToolkit.getClass() = class com.agf.MyToolkit But the result by using maven2 is different. I get this exception : testClassLoader(com.agf.MyTest) Time elapsed: 0.062 sec ERROR! java.awt.AWTError: Toolkit not found: com.agf.MyToolkit at java.awt.Toolkit$2.run(Toolkit.java:828) at java.security.AccessController.doPrivileged(Native Method) at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:804) at com.agf.MyTest.testClassLoader(MyTest.java:14) I think that surfire manage different ClassLoaders and the Toolkit is not in the good ClassLoader. Can anyone confim that ? and explain me how to solve this problem ? Thanks, Olivier 2006/8/16, Olivier Catteau [EMAIL PROTECTED]: Hi, I've got a problem when I try to use UISpec4J for unit testing Swing based applications. Iv'e got a test class that extends UISpecTestCase. In IntelliJ, my test works witout any problem. But, when I try to run my test by using Maven2, it throws an exception. ### [INFO] [surefire:test] [INFO] Surefire report directory: C:\DEV\projects\migration\agf-agent-bootstrap\target\surefire-reports org.apache.maven.surefire.booter.SurefireExecutionException: com.agf.workflow.gui.wizard.WizardWindowTest; nested exception is jav a.awt.AWTError: Toolkit not found: org.uispec4j.interception.toolkit.UISpecToolkit ; nested exception is org.apache.maven.surefire. testset.TestSetFailedException: com.agf.workflow.gui.wizard.WizardWindowTest; nested exception is java.awt.AWTError: Toolkit not f ound: org.uispec4j.interception.toolkit.UISpecToolkit org.apache.maven.surefire.testset.TestSetFailedException: com.agf.workflow.gui.wizard.WizardWindowTest; nested exception is java.awt.AWTError: Toolkit not found: org.uispec4j.interception.toolkit.UISpecToolkit java.awt.AWTError : Toolkit not found: org.uispec4j.interception.toolkit.UISpecToolkit at java.awt.Toolkit$2.run(Toolkit.java:828) at java.security.AccessController.doPrivileged(Native Method) at java.awt.Toolkit.getDefaultToolkit (Toolkit.java:804) at javax.swing.UIManager.clinit(UIManager.java:313) at org.uispec4j.interception.ui.UISpecLF.init(UISpecLF.java:11) at org.uispec4j.UISpec4J.init(UISpec4J.java:21) at org.uispec4j.UISpecTestCase.clinit(UISpecTestCase.java:31) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance ( NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance( DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:494) at junit.framework.TestSuite.createTest(TestSuite.java:131) at junit.framework.TestSuite.addTestMethod(TestSuite.java:114) at junit.framework.TestSuite.init(TestSuite.java:75) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance( NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance ( DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:494) at org.apache.maven.surefire.junit.JUnitTestSet.constructTestObject( JUnitTestSet.java:148) at org.apache.maven.surefire.junit.JUnitTestSet.getTestCount
Re: Creating archetype for multi-module project
Adam, Thanks for the answer... I tried this solution, but in this case, the packages/directories are always the sames, fixed to org/myorganization/component/sayhello in the sample, and not change according to the new project name. Or I would like that this package/directory change according to the groupId given in the archetype command line. I think it is the difference between the archetype/resources/resource tag and the archetype/sources/source tag in the archetype.xml , isn't it ? 2006/8/4, Adam Leggett [EMAIL PROTECTED]: Olivier, From my understanding, I believe in a multi-module archetype, all elements(sources/resources etc) need to be listed as a resource in your archetype.xml file. See the myfaces jsfcomponent as an example here: http://svn.apache.org/viewvc/myfaces/maven/trunk/maven-archetype-jsfcomp onents/src/main/resources/META-INF/archetype.xml?view=markup Adam -Original Message- From: Olivier Catteau [mailto:[EMAIL PROTECTED] Sent: Friday, August 04, 2006 1:57 PM To: Maven Users List Subject: Creating archetype for multi-module project Hi, I'd like to create my own archetype for multi-module projects. I took and customized the maven-archetype-j2ee-simple archetype at first. I've got a problem when I try to add a java class file in one of the existing modules of my personnal. I added the file App.java in the following directory maven-archetype-j2ee-simple\src\main\resources\archetype-resources\proje cts\logging\src\main\java\. And I modified archetype.xml like that : archetype idj2ee/id sources sourceprojects/logging/src/main/java/App.java/source !-- *** THE LINE I ADDED *** -- /sources resources ... resourceprojects/logging/pom.xml/resource resourceprojects/logging/src/main/java/App.java/resource ... /resources /archetype When I try to use my archetype, I've got this error : Embedded error: Template 'projects/logging/src/main/java/App.java' not in directory 'src/main/java' How to solve this problem ? Thanks. Olivier === The contents of this email are intended for the named addresses and may contain confidential and/or privileged material. If received in error, please contact UPCO head office on +44(0)113 201 0600 and then delete the entire mail from your system. Unauthorised review, distribution, disclosure or other use of information could constitute a breach of confidence. Your co-operation in this matter is greatly appreciated. Every effort has been taken to ensure that this email and any attachments are virus-free. However, UPCO does not make any warranty to this effect, and is not liable for any damage done by an infected email message or attachment. UPCO recommends that all emails and attachments are checked before opening. All views or opinions expressed in this electronic message and its attachements are those of the sender and do not necessarily reflect the views and opinions of The Ultimate People Company Ltd. === - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Plugin configuration with properties from settings.xml
Hi, I would like to be able to configure my plugin with properties that are stored in the settings.xml. Here is a piece of my settings.xml : settings ... profiles profile iddatabase-developer/id activation property name!database/name /property /activation properties databaseServerad_daf1/databaseServer databasePort34105/databasePort /properties /profile /profiles ... /settings Here is a pom to test my plugin : project namePOM For test/name build plugins plugin artifactIdmaven-antrun-plugin/artifactId executions execution phasecompile/phase configuration tasks echodatabaseServer : ${databaseServer}/echo /tasks /configuration goals goalrun/goal /goals /execution /executions /plugin plugin groupId.../groupId artifactId.../artifactId configuration databaseServer${databaseServer}/databaseServer databasePort${databasePort}/databasePort /configuration /plugin /plugins /build /project If I execute my plugin, the ant task resolve the property ${databaseServer}. But, in my mojo, I inject these properties and ${databaseServer} isn't resolved, so my attribute databaseServer equals ${databaseServer}. How can I do to resolve these properties in my mojo ? Do I need to explicitely use something like the plexus ExpressionEvaluator to resolve them (a piece of code may help me) ? Thanks Olivier
Re: Plugin configuration with properties from settings.xml
Yes I have looked at better builds with maven. The plugin is used to initialize a database. It reads directory to create tables, constraints, ..., it drop each objects of the DB and so on. Each developer has his own DB schema so his own settings to access this schema. So it seems good to store these properties in settings.xml, isn't it ? But when plexus injects these properties in my mojo, it doesn't resolve them. Is it the good method to store the properties in the settings.xml ? Do I need to use filtering and properties file ? 2006/7/31, Stefan Magnus Landrø [EMAIL PROTECTED]: You have to add databaseServer as a property in your plugin. What kind of mojo is it? Have you had a look at better builds with maven? Olivier Catteau [EMAIL PROTECTED] skrev 31.07.2006 15:58:01: Hi, I would like to be able to configure my plugin with properties that are stored in the settings.xml. Here is a piece of my settings.xml : settings ... profiles profile iddatabase-developer/id activation property name!database/name /property /activation properties databaseServerad_daf1/databaseServer databasePort34105/databasePort /properties /profile /profiles ... /settings Here is a pom to test my plugin : project namePOM For test/name build plugins plugin artifactIdmaven-antrun-plugin/artifactId executions execution phasecompile/phase configuration tasks echodatabaseServer : ${databaseServer}/echo /tasks /configuration goals goalrun/goal /goals /execution /executions /plugin plugin groupId.../groupId artifactId.../artifactId configuration databaseServer${databaseServer}/databaseServer databasePort${databasePort}/databasePort /configuration /plugin /plugins /build /project If I execute my plugin, the ant task resolve the property ${databaseServer}. But, in my mojo, I inject these properties and ${databaseServer} isn't resolved, so my attribute databaseServer equals ${databaseServer}. How can I do to resolve these properties in my mojo ? Do I need to explicitely use something like the plexus ExpressionEvaluator to resolve them (a piece of code may help me) ? Thanks Olivier