maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Frey" <daniel.f...@xmatrix.ch>
Subject AW: Maven classloader breaks URLs
Date Fri, 12 Nov 2004 10:02:17 GMT
Thanks for the hint. It solves the problem partly. But I get wired
behaviour, directories are not created aso. Is there a way to debug the
projects source code line by line within my IDE when the tests are run with
maven?

-----Urspr√ľngliche Nachricht-----
Von: Brett Porter [mailto:brett.porter@gmail.com] 
Gesendet: Donnerstag, 11. November 2004 23:33
An: Maven Users List
Betreff: Re: Maven classloader breaks URLs

I'd have to look closer to understand this and see whether it is a real
problem or not, but a possible workaround is to have your tests in a forked
JVM?

maven.junit.fork=true

- Brett


On Thu, 11 Nov 2004 12:51:13 +0100, Daniel Frey <qwer12341@gmx.ch> wrote:
> Hello
> 
> I am using a method SharkUtils.class.getResource to load resources for 
> my project. The resource is lateron addressed as a file:
> 
> 001  final String name = "sql/hsql/LoaderJob.olj";
> 002  final URL resource = SharkUtils.class.getResource(name);
> 003  final String external = resource.toExternalForm();
> 004  final URI uri = new URI(external);
> 005  final String string = uri.getRawPath();
> 006  final File file = new File(string);
> 
> Running such code in my IDE works great. The values of the variables 
> (using
> toString()) are:
> 
> 001  sql/hsql/LoaderJob.olj
> 002
> file:/E:/Daten/OrderManager/target/classes/ch/xmatrix/om/core/impl/sha
> rk/sql
> /hsql/LoaderJob.olj
> 003
> file:/E:/Daten/OrderManager/target/classes/ch/xmatrix/om/core/impl/sha
> rk/sql
> /hsql/LoaderJob.olj
> 004
> file:/E:/Daten/OrderManager/target/classes/ch/xmatrix/om/core/impl/sha
> rk/sql
> /hsql/LoaderJob.olj
> 005
> /E:/Daten/OrderManager/target/classes/ch/xmatrix/om/core/impl/shark/sq
> l/hsql
> /LoaderJob.olj
> 006
> E:\Daten\OrderManager\target\classes\ch\xmatrix\om\core\impl\shark\sql
> \hsql\
> LoaderJob.olj
> 
> However running it with maven (within a test case) failes. The values 
> of the variables are:
> 
> 001  sql/hsql/LoaderJob.olj
> 002
> file:E:/Daten/OrderManager/target/classes/ch/xmatrix/om/core/impl/shar
> k/sql/
> hsql/LoaderJob.olj
> 003
> file:E:/Daten/OrderManager/target/classes/ch/xmatrix/om/core/impl/shar
> k/sql/
> hsql/LoaderJob.olj
> 004
> file:E:/Daten/OrderManager/target/classes/ch/xmatrix/om/core/impl/shar
> k/sql/
> hsql/LoaderJob.olj
> 005  null
> 006  NPE
> 
> The difference is obvious. The URL is not translated to an absolute 
> reference, hence leading to a NPE. I do not know the internals of maven
but:
> If it uses an own class loader, this could explain the behaviour. Or 
> do you have another idea why the URL is not addressed absloutley? Any 
> ideas to resolve this issue?
> 
> Thanks
> Daniel
> 
> ---------------------------------------------------------------------
> 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





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


Mime
View raw message