Ran into trouble again. I might have buypassed the problem for a while, but the joy was not for long. Ok, here is the deal.
I have several artifacts. Some artifacts have resources in both main/resources and test/resources. The resources might be property files who's values is to be replaced with Springs PropertyPlaceholderConfigurer (at least this is how it was). It may also be two different spring config files (incrementer-context.xml), one the Oracle way and one the HSQL way. If I run my unittests in eclipse (maven plugin) everything is well. If I run 'mvn test' or 'mvn install' in parent dir everything is well. If I change dir to one of the artifacts with test dependency as mentioned obove mye tests fail because the test deps do not seem to be included. Looks like the classpath is somehow wrong in the last case, where test/resources and main/resources is replaced, or test resources not included at all. I have now prof of this, but it seems like this is what happens. I have tested mvn test -X, but I cant se anything wrong.....among the thousands of lines ;-) Anyone here that can tell me why this happens or better, what happens? I guess this has been my problem all along. -Ronny -----Opprinnelig melding----- Fra: Naess, Ronny [mailto:[EMAIL PROTECTED] Sendt: 27. september 2006 15:10 Til: Maven Users List Emne: SV: Build errors I bypassed the problem, replaced the two database.properties with two datasource-context.xml (imported into commons-config.xml) and typed the properties in for both test and main. It works well now and continuum gave me a big smile :-) Sure, why PropertyPlaceholderConfigurator fails I still do not know. -Ronny -----Opprinnelig melding----- Fra: Naess, Ronny [mailto:[EMAIL PROTECTED] Sendt: 27. september 2006 12:17 Til: Maven Users List Emne: SV: Build errors Anyone got any tips for me about this issue? It is starting to become a showstopper. Continuum almost never have a successfully build anymore. The failure is always the same where the exception is: org.springframework.beans.factory.BeanDefinitionStoreException: Error registering bean with name 'dataSource' defined in class path resource [commons-context.xml]: Could not resolve placeholder 'jdbc.driverClassName' My common-context.xml (spring config) is located in common artifact. Other artifacts depends on this common artifact. Common-context.xml ------------------ <bean id="propertyConfigurator" class="org.springframework.beans.factory.config.PropertyPlaceholderConfi gurer"> <property name="locations"> <list> <value>database.properties</value> <value>toolbox.properties</value> </list> </property> </bean> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName"> <value>${jdbc.driverClassName}</value> </property> <property name="url"> <value>${jdbc.url}</value> </property> <property name="username"> <value>${jdbc.username}</value> </property> <property name="password"> <value>${jdbc.password}</value> </property> </bean> Common artifact has two (2) resources named database.propeties. These files is located in main/resources and test/resources, where the one under test is the one used when testing (you did'nt see that comming did ya?). Database.properties (in test/resourses) --------------------------------------- jdbc.driverClassName=org.hsqldb.jdbcDriver jdbc.url=jdbc:hsqldb:file:../ansattportal-commons/hsqldb/ansattportal jdbc.username=sa jdbc.password= The commons pom.xml has test-jar goal so the dependent artifacts can include this test-jar file when running tests (scope=test). Now, when I try to test or install some of my artifacts that depend on common artifact I recive the error mentioned above. An as you can se a from my earlier posts its more or less random. Sometime it works sometime not. I am very much stuck on this matter and I could need a good tips in how to solve this problem. I am thinking that I might maybe hardcode two spring configs only containing the datasource part. One for test and one for main and that way skip the whole PropertyPlaceHolderConfigurer part that creates all this frustration. -Ronny -----Opprinnelig melding----- Fra: Naess, Ronny [mailto:[EMAIL PROTECTED] Sendt: 25. september 2006 13:00 Til: Maven Users List Emne: SV: Build errors I have tried different things but no pattern is discovered. I am logged on the unix server that Continuum is running on. I then change directory to the artifact that fails. Things I have tried: mvn install -> failure mvn clean -> success mvn test -> success mvn install -> failure mvn install -> failure mvn install -> failure mvn test -> failure mvn test -> failure mvn clean test -> failure mvn clean -> success mvn test -> success mvn clean -> success mvn test -> success mvn clean -> success mvn test -> success mvn clean test -> failure mvn clean test -> failure mvn clean test -> failure mvn test -> failure mvn test -> failure mvn clean -> success mvn test -> success mvn test -> failure mvn test -> failure mvn clean -> success mvn install -> failure mvn clean -> success mvn install -> success mvn clean -> success mvn install -> failure mvn clean -> success mvn install -> failure mvn clean -> success mvn install -> success mvn clean -> success mvn test -> success mvn test -> success What I can see so far. 'mvn clean test' always failure 'mvn clean' followed by 'mvn test' always success (however failed several times on my Win XP laptop) 'mvn test' followed by 'mvn test' sometimes success and sometimes failure 'mvn clean' followed by 'mvn install' sometimes success and sometimes failure Could it be that my pom has something that could give me the unstable pattern that is shown here? My pom.xml ------------------------------------------------------------------------ ------------ <?xml version="1.0" encoding="iso-8859-1"?> <project 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/maven-v4_0_0.xsd"> <parent> <artifactId>ansattportal</artifactId> <groupId>no.avinor</groupId> <version>1.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <groupId>no.avinor</groupId> <artifactId>ansattportal-jdbcDao</artifactId> <name>ansattportal-jdbcDao</name> <description>Data Access Objects (Implementation)</description> <version>1.0-SNAPSHOT</version> <dependencies> <dependency> <groupId>no.avinor</groupId> <artifactId>ansattportal-dao</artifactId> <version>1.0-SNAPSHOT</version> </dependency> <dependency> <groupId>no.avinor</groupId> <artifactId>ansattportal-commons</artifactId> <version>1.0-SNAPSHOT</version> </dependency> <dependency> <groupId>no.avinor</groupId> <artifactId>ansattportal-commons</artifactId> <version>1.0-SNAPSHOT</version> <type>test-jar</type> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <executions> <execution> <goals> <goal>test-jar</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </project> ------------------------------------------------------------------------ ------------ Any ideas? -Ronny -----Opprinnelig melding----- Fra: Naess, Ronny [mailto:[EMAIL PROTECTED] Sendt: 25. september 2006 10:14 Til: users@maven.apache.org Emne: Build errors Hi. I am building my modules with Maven 2. The build is executed from top level (parent). The build process seems to be unstable. Sometime it goes well other times not. When it breaks there is always an exception telling me that Springs propertyPlaceHolderConfigurer not has replaced my property values in my spring-config like it is supposed to. I think this tells me that the dependencies might be skipped or bypassed some times. I can't find a pattern. Anyone experienced the same? This is the exception (mvn test -e): ------------------------------------------------------- T E S T S ------------------------------------------------------- Running no.avinor.ansattportal.dao.jdbcTemplate.ArticleJdbcDaoTest 17:08:09,718 INFO (no.avinor.ansattportal.test.SpringTestCase.springInit(SpringTestCase.ja va:103)) - Configuring sprin 17:08:10,812 FATAL (no.avinor.ansattportal.test.SpringTestCase.springInit(SpringTestCase.ja va:111)) - org.springframew rk.beans.factory.BeanDefinitionStoreException: Error registering bean with name 'dataSource' defined in class path reso rce [commons-context.xml]: Could not resolve placeholder 'jdbc.driverClassName' 17:08:10,828 INFO (no.avinor.ansattportal.test.SpringTestCase.springInit(SpringTestCase.ja va:103)) - Configuring spri g 17:08:10,953 FATAL (no.avinor.ansattportal.test.SpringTestCase.springInit(SpringTestCase.ja va:111)) - org.springframew rk.beans.factory.BeanDefinitionStoreException: Error registering bean with name 'dataSource' defined in class path reso rce [commons-context.xml]: Could not resolve placeholder 'jdbc.driverClassName' 17:08:10,953 INFO (no.avinor.ansattportal.test.SpringTestCase.springInit(SpringTestCase.ja va:103)) - Configuring spri g 17:08:11,031 FATAL (no.avinor.ansattportal.test.SpringTestCase.springInit(SpringTestCase.ja va:111)) - org.springframew rk.beans.factory.BeanDefinitionStoreException: Error registering bean with name 'dataSource' defined in class path reso rce [commons-context.xml]: Could not resolve placeholder 'jdbc.driverClassName' 17:08:11,078 INFO (no.avinor.ansattportal.test.SpringTestCase.springInit(SpringTestCase.ja va:103)) - Configuring spri g 17:08:11,156 FATAL (no.avinor.ansattportal.test.SpringTestCase.springInit(SpringTestCase.ja va:111)) - org.springframew rk.beans.factory.BeanDefinitionStoreException: Error registering bean with name 'dataSource' defined in class path reso rce [commons-context.xml]: Could not resolve placeholder 'jdbc.driverClassName' 17:08:11,171 INFO (no.avinor.ansattportal.test.SpringTestCase.springInit(SpringTestCase.ja va:103)) - Configuring spri g 17:08:11,281 FATAL (no.avinor.ansattportal.test.SpringTestCase.springInit(SpringTestCase.ja va:111)) - org.springframew rk.beans.factory.BeanDefinitionStoreException: Error registering bean with name 'dataSource' defined in class path reso rce [commons-context.xml]: Could not resolve placeholder 'jdbc.driverClassName' 17:08:11,281 INFO (no.avinor.ansattportal.test.SpringTestCase.springInit(SpringTestCase.ja va:103)) - Configuring spri g 17:08:11,375 FATAL (no.avinor.ansattportal.test.SpringTestCase.springInit(SpringTestCase.ja va:111)) - org.springframew rk.beans.factory.BeanDefinitionStoreException: Error registering bean with name 'dataSource' defined in class path reso rce [commons-context.xml]: Could not resolve placeholder 'jdbc.driverClassName' @SLTests run: 6, Failures: 0, Errors: 6, Skipped: 0, Time elapsed: 1.719 sec <<< FAILURE! Running no.avinor.ansattportal.dao.jdbcTemplate.ProjectroomJdbcDaoTest 17:08:11,406 INFO (no.avinor.ansattportal.test.SpringTestCase.springInit(SpringTestCase.ja va:103)) - Configuring sprin 17:08:11,531 FATAL (no.avinor.ansattportal.test.SpringTestCase.springInit(SpringTestCase.ja va:111)) - org.springframew rk.beans.factory.BeanDefinitionStoreException: Error registering bean with name 'dataSource' defined in class path reso rce [commons-context.xml]: Could not resolve placeholder 'jdbc.driverClassName' 17:08:11,531 INFO (no.avinor.ansattportal.test.SpringTestCase.springInit(SpringTestCase.ja va:103)) - Configuring spri g 17:08:11,625 FATAL (no.avinor.ansattportal.test.SpringTestCase.springInit(SpringTestCase.ja va:111)) - org.springframew rk.beans.factory.BeanDefinitionStoreException: Error registering bean with name 'dataSource' defined in class path reso rce [commons-context.xml]: Could not resolve placeholder 'jdbc.driverClassName' 17:08:11,640 INFO (no.avinor.ansattportal.test.SpringTestCase.springInit(SpringTestCase.ja va:103)) - Configuring spri g 17:08:11,750 FATAL (no.avinor.ansattportal.test.SpringTestCase.springInit(SpringTestCase.ja va:111)) - org.springframew rk.beans.factory.BeanDefinitionStoreException: Error registering bean with name 'dataSource' defined in class path reso rce [commons-context.xml]: Could not resolve placeholder 'jdbc.driverClassName' @SLTests run: 3, Failures: 0, Errors: 3, Skipped: 0, Time elapsed: 0.375 sec <<< FAILURE! Results : Tests run: 9, Failures: 0, Errors: 9, Skipped: 0 [INFO] ------------------------------------------------------------------------ [ERROR] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] There are test failures. [INFO] ------------------------------------------------------------------------ [INFO] Trace org.apache.maven.BuildFailureException: There are test failures. at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Default LifecycleExecutor.java:555) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifec ycle(DefaultLifecycleExecutor.java:4 5) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultL ifecycleExecutor.java:454) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandle Failures(DefaultLifecycleExecutor.ja a:306) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments( DefaultLifecycleExecutor.java:273) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifec ycleExecutor.java:140) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115) at org.apache.maven.cli.MavenCli.main(MavenCli.java:256) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav a:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor Impl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) at org.codehaus.classworlds.Launcher.launch(Launcher.java:255) at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) at org.codehaus.classworlds.Launcher.main(Launcher.java:375) Caused by: org.apache.maven.plugin.MojoFailureException: There are test failures. at org.apache.maven.plugin.surefire.SurefirePlugin.execute(SurefirePlugin.j ava:403) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginMa nager.java:412) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Default LifecycleExecutor.java:534) ... 16 more [INFO] ------------------------------------------------------------------------ [INFO] Total time: 7 seconds [INFO] Finished at: Fri Sep 15 17:08:11 CEST 2006 [INFO] Final Memory: 5M/10M [INFO] ------------------------------------------------------------------------ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] !DSPAM:451a7be6238831550420230! --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]