You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Olivier Lamy <ol...@accor.com> on 2006/05/18 10:21:01 UTC

RE : Repost: [m2] surefire classloading issue

Try with 
        <plugin>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.2</version>
          <configuration>
            <forkMode>never</forkMode> 
          </configuration>
        </plugin>

        <plugin>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.1.3</version>
        </plugin>

This two configurations saved me.
Probably related to http://jira.codehaus.org/browse/MSUREFIRE-109 (not
sure).

I have some trouble with spring resources (that's why I use
<forkMode>never</forkMode>  with 2.2)
 
HTH,
-Olivier
-----Message d'origine-----
De : Wim Deblauwe [mailto:wim.deblauwe@gmail.com] 
Envoyé : jeudi 18 mai 2006 10:13
À : Maven Users List
Objet : Repost: [m2] surefire classloading issue


Anybody any thoughts on this? If nobody can help me, I will file this as
a bug in JIRA if that is ok.

regards,

Wim

---------- Forwarded message ----------
From: Wim Deblauwe <wi...@gmail.com>
Date: 16-mei-2006 13:43
Subject: [m2] surefire classloading issue
To: Maven Users List <us...@maven.apache.org>

Hi,

I'm using Maven 1, trying to migrate.

We are using Betwixt and some of our unit tests fail when run using
surefire, but run fine in IntelliJ or Maven 1. Betwixt looks for
descriptors with the name of the class + .betwixt to control how
something is written out in XML. It uses the construct:
myClass.getResource() to find the .betwixt file.

E.g. com.mycomp.MyClass -> com/mycomp/MyClass.betwixt

We have a betwixt file for the java.util.Date class. However, betwixt
seems to be unable to pick it up when using surefire. I have created a
small test that shows the problem.

import junit.framework.TestCase;
import java.util.Date;
import java.net.URL;

public class CLTest extends TestCase
{
    public void testClassloading()
    {
        ClassLoader classLoader = getClass().getClassLoader();
        System.out.println( "classLoader: " + classLoader );
        URL resource = getClass().getResource( "/java/util/Date.betwixt"
);
        System.out.println( "resource: " + resource );
        ClassLoader dateClassLoader = Date.class.getClassLoader();
        System.out.println( "dateClassLoader: " + dateClassLoader );
        URL dateResource = Date.class.getResource(
"/java/util/Date.betwixt" );
        System.out.println( "dateResource: " + dateResource );

    }
}

When running this class through IntelliJ, the output is:

classLoader: org.apache.maven.surefire.IsolatedClassLoader@1490eb5
resource:
file:/C:/javatests/surefire-test/target/classes/java/util/Date.betwixt
dateClassLoader: null
dateResource:
file:/C:/javatests/surefire-test/target/classes/java/util/Date.betwixt

However, when using surefire, I get:

classLoader: org.apache.maven.surefire.IsolatedClassLoader@1490eb5
resource:
file:/C:/javatests/surefire-test/target/classes/java/util/Date.betwixt
dateClassLoader: null
dateResource: null


any ideas?

regards,

Wim



This e-mail, any attachments and the information contained therein ("this message") are confidential and intended solely for the use of the addressee(s). If you have received this message in error please send it back to the sender and delete it. Unauthorized publication, use, dissemination or disclosure of this message, either in whole or in part is strictly prohibited.
********************************************************************** 
Ce message électronique et tous les fichiers joints ainsi que  les informations contenues dans ce message ( ci après "le message" ), sont confidentiels et destinés exclusivement à l'usage de la  personne à laquelle ils sont adressés. Si vous avez reçu ce message par erreur, merci  de le renvoyer à son émetteur et de le détruire. Toutes diffusion, publication, totale ou partielle ou divulgation sous quelque forme que se soit non expressément autorisées de ce message, sont interdites.
********************************************************************** 


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


Re: RE : Repost: [m2] surefire classloading issue

Posted by Wim Deblauwe <wi...@gmail.com>.
It does not help. I still have the same problem.

Using version 2.1.3, I see that the URLClassLoader is used in stead of the
IsolatedClassLoader in version 2.2, but it does not change anything for my
test.

the problem might be related to the one you mention, but it is not really
the same so I created a new problem in JIRA:
http://jira.codehaus.org/browse/MSUREFIRE-115

regards,

Wim

2006/5/18, Olivier Lamy <ol...@accor.com>:
>
> Try with
>         <plugin>
>           <artifactId>maven-surefire-plugin</artifactId>
>           <version>2.2</version>
>           <configuration>
>             <forkMode>never</forkMode>
>           </configuration>
>         </plugin>
>
>         <plugin>
>           <artifactId>maven-surefire-plugin</artifactId>
>           <version>2.1.3</version>
>         </plugin>
>
> This two configurations saved me.
> Probably related to http://jira.codehaus.org/browse/MSUREFIRE-109 (not
> sure).
>
> I have some trouble with spring resources (that's why I use
> <forkMode>never</forkMode>  with 2.2)
>
> HTH,
> -Olivier
> -----Message d'origine-----
> De : Wim Deblauwe [mailto:wim.deblauwe@gmail.com]
> Envoyé : jeudi 18 mai 2006 10:13
> À : Maven Users List
> Objet : Repost: [m2] surefire classloading issue
>
>
> Anybody any thoughts on this? If nobody can help me, I will file this as
> a bug in JIRA if that is ok.
>
> regards,
>
> Wim
>
> ---------- Forwarded message ----------
> From: Wim Deblauwe <wi...@gmail.com>
> Date: 16-mei-2006 13:43
> Subject: [m2] surefire classloading issue
> To: Maven Users List <us...@maven.apache.org>
>
> Hi,
>
> I'm using Maven 1, trying to migrate.
>
> We are using Betwixt and some of our unit tests fail when run using
> surefire, but run fine in IntelliJ or Maven 1. Betwixt looks for
> descriptors with the name of the class + .betwixt to control how
> something is written out in XML. It uses the construct:
> myClass.getResource() to find the .betwixt file.
>
> E.g. com.mycomp.MyClass -> com/mycomp/MyClass.betwixt
>
> We have a betwixt file for the java.util.Date class. However, betwixt
> seems to be unable to pick it up when using surefire. I have created a
> small test that shows the problem.
>
> import junit.framework.TestCase;
> import java.util.Date;
> import java.net.URL;
>
> public class CLTest extends TestCase
> {
>     public void testClassloading()
>     {
>         ClassLoader classLoader = getClass().getClassLoader();
>         System.out.println( "classLoader: " + classLoader );
>         URL resource = getClass().getResource( "/java/util/Date.betwixt"
> );
>         System.out.println( "resource: " + resource );
>         ClassLoader dateClassLoader = Date.class.getClassLoader();
>         System.out.println( "dateClassLoader: " + dateClassLoader );
>         URL dateResource = Date.class.getResource(
> "/java/util/Date.betwixt" );
>         System.out.println( "dateResource: " + dateResource );
>
>     }
> }
>
> When running this class through IntelliJ, the output is:
>
> classLoader: org.apache.maven.surefire.IsolatedClassLoader@1490eb5
> resource:
> file:/C:/javatests/surefire-test/target/classes/java/util/Date.betwixt
> dateClassLoader: null
> dateResource:
> file:/C:/javatests/surefire-test/target/classes/java/util/Date.betwixt
>
> However, when using surefire, I get:
>
> classLoader: org.apache.maven.surefire.IsolatedClassLoader@1490eb5
> resource:
> file:/C:/javatests/surefire-test/target/classes/java/util/Date.betwixt
> dateClassLoader: null
> dateResource: null
>
>
> any ideas?
>
> regards,
>
> Wim
>
>
>
> This e-mail, any attachments and the information contained therein ("this
> message") are confidential and intended solely for the use of the
> addressee(s). If you have received this message in error please send it back
> to the sender and delete it. Unauthorized publication, use, dissemination or
> disclosure of this message, either in whole or in part is strictly
> prohibited.
> **********************************************************************
> Ce message électronique et tous les fichiers joints ainsi que  les
> informations contenues dans ce message ( ci après "le message" ), sont
> confidentiels et destinés exclusivement à l'usage de la  personne à laquelle
> ils sont adressés. Si vous avez reçu ce message par erreur, merci  de le
> renvoyer à son émetteur et de le détruire. Toutes diffusion, publication,
> totale ou partielle ou divulgation sous quelque forme que se soit non
> expressément autorisées de ce message, sont interdites.
> **********************************************************************
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>