You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by diyfiesta <to...@gmail.com> on 2006/09/22 22:35:59 UTC

[M1] Running tests with jvmargs (security policy)

Hi Folks,

Bit stuck on trying to run my tests with a security manager enabled and a
specific policy file. I added the security manager system property and
policy setting using the following in the properties file
(project.properties) and have the policy file set as a <resource> under for
the unit tests (it physically exists where I expect it to).

maven.junit.jvmargs=-Djava.security.manager
-Djava.security.policy=/target/test-classes/testing.policy

but I just can't get it to see the policy file (and so the tests fail with
permission problems).

It works fine if I hard code it like this;

maven.junit.jvmargs=-Djava.security.manager
-Djava.security.policy=c:\\temp\\testing.policy

but that obviously doesn't work unless I first copy the file there first
(which I don't want to do). 

I thought the VM is run from ${basedir} so my orginal setting should work?
I've tried it as just testing.policy thinking it would spot it on the
classpath, and even ${basedir}/blar/blar/testing.policy but then it just
fails with class not found (wierd!).

Any tips folks? :)

Thanks a million in advance,
Toby
-- 
View this message in context: http://www.nabble.com/-M1--Running-tests-with-jvmargs-%28security-policy%29-tf2319941.html#a6454630
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: [M1] Running tests with jvmargs (security policy)

Posted by diyfiesta <to...@gmail.com>.
Hi, 

Thanks for that. You know, last night I randomly just tried dropping the
first slash and it worked a treat! grrr, spent hours over a redundant
forward slash! ;)

One of those days...

Thanks


Arnaud HERITIER wrote:
> 
> Are sure that /target/test-classes/testing.policy isn't computed as an
> absolute path : c:/target/test-classes/testing.policy
> Did you try ? : -Djava.security.policy=target/test-classes/testing.policy
> 
> Arnaud
> 
> On 9/22/06, diyfiesta <to...@gmail.com> wrote:
>>
>>
>> Hi Folks,
>>
>> Bit stuck on trying to run my tests with a security manager enabled and a
>> specific policy file. I added the security manager system property and
>> policy setting using the following in the properties file
>> (project.properties) and have the policy file set as a <resource> under
>> for
>> the unit tests (it physically exists where I expect it to).
>>
>> maven.junit.jvmargs=-Djava.security.manager
>> -Djava.security.policy=/target/test-classes/testing.policy
>>
>> but I just can't get it to see the policy file (and so the tests fail
>> with
>> permission problems).
>>
>> It works fine if I hard code it like this;
>>
>> maven.junit.jvmargs=-Djava.security.manager
>> -Djava.security.policy=c:\\temp\\testing.policy
>>
>> but that obviously doesn't work unless I first copy the file there first
>> (which I don't want to do).
>>
>> I thought the VM is run from ${basedir} so my orginal setting should
>> work?
>> I've tried it as just testing.policy thinking it would spot it on the
>> classpath, and even ${basedir}/blar/blar/testing.policy but then it just
>> fails with class not found (wierd!).
>>
>> Any tips folks? :)
>>
>> Thanks a million in advance,
>> Toby
>> --
>> View this message in context:
>> http://www.nabble.com/-M1--Running-tests-with-jvmargs-%28security-policy%29-tf2319941.html#a6454630
>> 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/-M1--Running-tests-with-jvmargs-%28security-policy%29-tf2319941.html#a6482091
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: [M1] Running tests with jvmargs (security policy)

Posted by Arnaud HERITIER <ah...@gmail.com>.
Are sure that /target/test-classes/testing.policy isn't computed as an
absolute path : c:/target/test-classes/testing.policy
Did you try ? : -Djava.security.policy=target/test-classes/testing.policy

Arnaud

On 9/22/06, diyfiesta <to...@gmail.com> wrote:
>
>
> Hi Folks,
>
> Bit stuck on trying to run my tests with a security manager enabled and a
> specific policy file. I added the security manager system property and
> policy setting using the following in the properties file
> (project.properties) and have the policy file set as a <resource> under
> for
> the unit tests (it physically exists where I expect it to).
>
> maven.junit.jvmargs=-Djava.security.manager
> -Djava.security.policy=/target/test-classes/testing.policy
>
> but I just can't get it to see the policy file (and so the tests fail with
> permission problems).
>
> It works fine if I hard code it like this;
>
> maven.junit.jvmargs=-Djava.security.manager
> -Djava.security.policy=c:\\temp\\testing.policy
>
> but that obviously doesn't work unless I first copy the file there first
> (which I don't want to do).
>
> I thought the VM is run from ${basedir} so my orginal setting should work?
> I've tried it as just testing.policy thinking it would spot it on the
> classpath, and even ${basedir}/blar/blar/testing.policy but then it just
> fails with class not found (wierd!).
>
> Any tips folks? :)
>
> Thanks a million in advance,
> Toby
> --
> View this message in context:
> http://www.nabble.com/-M1--Running-tests-with-jvmargs-%28security-policy%29-tf2319941.html#a6454630
> 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
>
>