You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Francesco Vivoli <f....@gmail.com> on 2007/12/03 10:16:03 UTC

Re: 2.0.8 broken war build

Hi all

I've just posted a similar issue[*]; I'm also using war packaging and 
setting <forkMode>never</forkMode> solved it.

I still wonder what happens though...
Anyone's got an explanation?

Cheers
Francesco


*: http://www.nabble.com/Failing-test-suite-with-2.0.8-tf4934941s177.html

Damien Lecan 2 wrote:
> 
> Similar problem for me when swithcing from 2.07 to 2.0.8
> 
> Despite http://jira.codehaus.org/browse/MNG-3118, config files are now
> read by surefire classloader in target/classes first, then in
> target/test-classes
> 
> Try a simple getClass().getResource("/my.property")
> 
> As a workaround, I configured surefire 2.3 with this :
> <forkMode>never</forkMode>
> 
> Then Surefire classloader read config file in target/test-classes first.
> 
> Strange thing, I had to do that only for projects with war packaging
> (but with classical unit tests).
> 
> So hard to say if it's a bug with surefire, war plugin (?) or Maven
> itself.
> 
> Damien Lecan
> 
> 2007/11/29, Paul Benedict <pb...@apache.org>:
>> Kev,
>>
>> I reported something similar in the user list today. The classpath that
>> Spring gets back in 2.0.8 points to classes, not test-classes, so all my
>> testing data cannot be found. As you said, things work fine in 2.0.7
>>
>> Paul
>>
>> On Nov 28, 2007 9:29 PM, Kev Jackson <fo...@gmail.com> wrote:
>>
>> > Hi,
>> >
>> > I've just been re-building my project with the new mvn 2.0.8 binary.
>> >
>> > Here's my experience so far.
>> >
>> > mvn clean install (jars) -> works as 2.0.7
>> >
>> > mvn clean package -P<profile> (war) -> broken (re-tested on 2.0.7 and
>> > works)
>> >
>> > So something has changed in 2.0.8 that has affected surefire.
>> >
>> > Here is a snippet of the error
>> >
>> > Nov 29, 2007 10:09:01 AM com.seanergie.persistence.SessionsManager
>> > initialize
>> > SEVERE: Exception building Hibernate SessionFactory :
>> > Could not find datasource
>> > org.hibernate.HibernateException: Could not find datasource
>> >         at
>> > org.hibernate.connection.DatasourceConnectionProvider.configure(Datas
>> > ourceConnectionProvider.java:56)
>> >         at
>> > org.hibernate.connection.ConnectionProviderFactory.newConnectionProvi
>> > der(ConnectionProviderFactory.java:124)
>> >         at
>> > org.hibernate.connection.ConnectionProviderFactory.newConnectionProvi
>> >
>> > For each unit test that uses Hibernate (v3 with Annotations &
>> > HibernateSearch), the same error 'Could not find datasource'.
>> >
>> > For mvn 2.0.7 the build works perfectly.
>> >
>> > I haven't changed my hibernate.cfg.xml file between builds, I haven't
>> > changed any code or config between builds, the only thing I changed was
>> > MVN_HOME & PATH to 2.0.8.
>> >
>> > As these errors occur during the surefire:test phase of the build I'm
>> > assuming that something has changed in the Classpath management for
>> > surefire?
>> >
>> > Any help would be appreciated.
>> >
>> > Thanks,
>> > Kev
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> > For additional commands, e-mail: users-help@maven.apache.org
>> >
>> >
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/2.0.8-broken-war-build-tf4894912s177.html#a14126098
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: 2.0.8 broken war build

Posted by Francesco Vivoli <f....@gmail.com>.
In my case it's not the ordering that causes trouble, in fact no matter
how I set the forkmode my classpath looks like this (running with -X):

[DEBUG]   (f) classpathElements =
[/Users/villo/Documents/projects/atalaya/trunk/atalaya-web/target/test-classes,
/Users/villo/Documents/projects/atalaya/trunk/atalaya-web/target/classes,
/Users/villo/.m2/repository/junit/junit/4.2/junit-4.2.jar...


Both test-classes and classes are added to the classpath, and my test
resources
are found. I don't use Spring wildcard matching though.
Have you tried to see if resources in other locations rather than . (the
classpath root)
are picked up?

I don't know if it's relevant but in my pom I've got this as well

        <testResources>
            <testResource>
                <directory>src/main/webapp/WEB-INF</directory>
            </testResource>
            <testResource>
                <directory>src/test/resources</directory>
            </testResource>
        </testResources>


Francesco



Paul Benedict-2 wrote:
> 
> Francesco, how did you determine that forking creates the correct
> classpath
> ordering?
> 
> On Dec 3, 2007 3:16 AM, Francesco Vivoli <f....@gmail.com> wrote:
> 
>>
>> Hi all
>>
>> I've just posted a similar issue[*]; I'm also using war packaging and
>> setting <forkMode>never</forkMode> solved it.
>>
>> I still wonder what happens though...
>> Anyone's got an explanation?
>>
>> Cheers
>> Francesco
>>
>>
>> *: http://www.nabble.com/Failing-test-suite-with-2.0.8-tf4934941s177.html
>>
>> Damien Lecan 2 wrote:
>> >
>> > Similar problem for me when swithcing from 2.07 to 2.0.8
>> >
>> > Despite http://jira.codehaus.org/browse/MNG-3118, config files are now
>> > read by surefire classloader in target/classes first, then in
>> > target/test-classes
>> >
>> > Try a simple getClass().getResource("/my.property")
>> >
>> > As a workaround, I configured surefire 2.3 with this :
>> > <forkMode>never</forkMode>
>> >
>> > Then Surefire classloader read config file in target/test-classes
>> first.
>> >
>> > Strange thing, I had to do that only for projects with war packaging
>> > (but with classical unit tests).
>> >
>> > So hard to say if it's a bug with surefire, war plugin (?) or Maven
>> > itself.
>> >
>> > Damien Lecan
>> >
>> > 2007/11/29, Paul Benedict <pb...@apache.org>:
>> >> Kev,
>> >>
>> >> I reported something similar in the user list today. The classpath
>> that
>> >> Spring gets back in 2.0.8 points to classes, not test-classes, so all
>> my
>> >> testing data cannot be found. As you said, things work fine in 2.0.7
>> >>
>> >> Paul
>> >>
>> >> On Nov 28, 2007 9:29 PM, Kev Jackson <fo...@gmail.com> wrote:
>> >>
>> >> > Hi,
>> >> >
>> >> > I've just been re-building my project with the new mvn 2.0.8 binary.
>> >> >
>> >> > Here's my experience so far.
>> >> >
>> >> > mvn clean install (jars) -> works as 2.0.7
>> >> >
>> >> > mvn clean package -P<profile> (war) -> broken (re-tested on 2.0.7
>> and
>> >> > works)
>> >> >
>> >> > So something has changed in 2.0.8 that has affected surefire.
>> >> >
>> >> > Here is a snippet of the error
>> >> >
>> >> > Nov 29, 2007 10:09:01 AM com.seanergie.persistence.SessionsManager
>> >> > initialize
>> >> > SEVERE: Exception building Hibernate SessionFactory :
>> >> > Could not find datasource
>> >> > org.hibernate.HibernateException: Could not find datasource
>> >> >         at
>> >> >
>> org.hibernate.connection.DatasourceConnectionProvider.configure(Datas
>> >> > ourceConnectionProvider.java:56)
>> >> >         at
>> >> >
>> org.hibernate.connection.ConnectionProviderFactory.newConnectionProvi
>> >> > der(ConnectionProviderFactory.java:124)
>> >> >         at
>> >> >
>> org.hibernate.connection.ConnectionProviderFactory.newConnectionProvi
>> >> >
>> >> > For each unit test that uses Hibernate (v3 with Annotations &
>> >> > HibernateSearch), the same error 'Could not find datasource'.
>> >> >
>> >> > For mvn 2.0.7 the build works perfectly.
>> >> >
>> >> > I haven't changed my hibernate.cfg.xml file between builds, I
>> haven't
>> >> > changed any code or config between builds, the only thing I changed
>> was
>> >> > MVN_HOME & PATH to 2.0.8.
>> >> >
>> >> > As these errors occur during the surefire:test phase of the build
>> I'm
>> >> > assuming that something has changed in the Classpath management for
>> >> > surefire?
>> >> >
>> >> > Any help would be appreciated.
>> >> >
>> >> > Thanks,
>> >> > Kev
>> >> >
>> >> >
>> ---------------------------------------------------------------------
>> >> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> >> > For additional commands, e-mail: users-help@maven.apache.org
>> >> >
>> >> >
>> >>
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> > For additional commands, e-mail: users-help@maven.apache.org
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/2.0.8-broken-war-build-tf4894912s177.html#a14126098
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/2.0.8-broken-war-build-tf4894912s177.html#a14146386
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: 2.0.8 broken war build

Posted by Paul Benedict <pb...@apache.org>.
Francesco, how did you determine that forking creates the correct classpath
ordering?

On Dec 3, 2007 3:16 AM, Francesco Vivoli <f....@gmail.com> wrote:

>
> Hi all
>
> I've just posted a similar issue[*]; I'm also using war packaging and
> setting <forkMode>never</forkMode> solved it.
>
> I still wonder what happens though...
> Anyone's got an explanation?
>
> Cheers
> Francesco
>
>
> *: http://www.nabble.com/Failing-test-suite-with-2.0.8-tf4934941s177.html
>
> Damien Lecan 2 wrote:
> >
> > Similar problem for me when swithcing from 2.07 to 2.0.8
> >
> > Despite http://jira.codehaus.org/browse/MNG-3118, config files are now
> > read by surefire classloader in target/classes first, then in
> > target/test-classes
> >
> > Try a simple getClass().getResource("/my.property")
> >
> > As a workaround, I configured surefire 2.3 with this :
> > <forkMode>never</forkMode>
> >
> > Then Surefire classloader read config file in target/test-classes first.
> >
> > Strange thing, I had to do that only for projects with war packaging
> > (but with classical unit tests).
> >
> > So hard to say if it's a bug with surefire, war plugin (?) or Maven
> > itself.
> >
> > Damien Lecan
> >
> > 2007/11/29, Paul Benedict <pb...@apache.org>:
> >> Kev,
> >>
> >> I reported something similar in the user list today. The classpath that
> >> Spring gets back in 2.0.8 points to classes, not test-classes, so all
> my
> >> testing data cannot be found. As you said, things work fine in 2.0.7
> >>
> >> Paul
> >>
> >> On Nov 28, 2007 9:29 PM, Kev Jackson <fo...@gmail.com> wrote:
> >>
> >> > Hi,
> >> >
> >> > I've just been re-building my project with the new mvn 2.0.8 binary.
> >> >
> >> > Here's my experience so far.
> >> >
> >> > mvn clean install (jars) -> works as 2.0.7
> >> >
> >> > mvn clean package -P<profile> (war) -> broken (re-tested on 2.0.7 and
> >> > works)
> >> >
> >> > So something has changed in 2.0.8 that has affected surefire.
> >> >
> >> > Here is a snippet of the error
> >> >
> >> > Nov 29, 2007 10:09:01 AM com.seanergie.persistence.SessionsManager
> >> > initialize
> >> > SEVERE: Exception building Hibernate SessionFactory :
> >> > Could not find datasource
> >> > org.hibernate.HibernateException: Could not find datasource
> >> >         at
> >> > org.hibernate.connection.DatasourceConnectionProvider.configure(Datas
> >> > ourceConnectionProvider.java:56)
> >> >         at
> >> > org.hibernate.connection.ConnectionProviderFactory.newConnectionProvi
> >> > der(ConnectionProviderFactory.java:124)
> >> >         at
> >> > org.hibernate.connection.ConnectionProviderFactory.newConnectionProvi
> >> >
> >> > For each unit test that uses Hibernate (v3 with Annotations &
> >> > HibernateSearch), the same error 'Could not find datasource'.
> >> >
> >> > For mvn 2.0.7 the build works perfectly.
> >> >
> >> > I haven't changed my hibernate.cfg.xml file between builds, I haven't
> >> > changed any code or config between builds, the only thing I changed
> was
> >> > MVN_HOME & PATH to 2.0.8.
> >> >
> >> > As these errors occur during the surefire:test phase of the build I'm
> >> > assuming that something has changed in the Classpath management for
> >> > surefire?
> >> >
> >> > Any help would be appreciated.
> >> >
> >> > Thanks,
> >> > Kev
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >> > For additional commands, e-mail: users-help@maven.apache.org
> >> >
> >> >
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/2.0.8-broken-war-build-tf4894912s177.html#a14126098
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>