Am 12.07.2012 23:19, schrieb Wayne Fay:
>> With JUnit everthing is perfekt on Linux and Windows. With Maven it
> What version of JUnit and how are you calling it?
>
>
>> works perfekt under Linux, but fails sometimes under Windows 7 64.
> What is the failure under Windows? Can you add code to trap that error
> and report the details? Do you have any idea why it fails sometimes
> but not always?
>
>
>> I know there is an issue with file handling on Windows that does not
>> exists on Linux, but wondering that JUnit do the trick and Maven don't
>> do it (sometimes).
>> Does anyone knows a solution, if it is a Maven problem?
> For good measure, I'd suggest adding config to your pom to specify the
> Surefire version:
> <build>
> <plugins>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-surefire-plugin</artifactId>
> <version>2.12</version>
> <dependencies>
> <dependency>
> <groupId>org.apache.maven.surefire</groupId>
> <artifactId>surefire-junit47</artifactId>
> <version>2.12</version>
> </dependency>
> </dependencies>
> </plugin>
> </plugins>
> </build>
>
> Windows is annoying for reasons like this so I try to stay on OSX and
> Linux whenever possible.
>
> Wayne
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
Damn, you made my day!
Now everything works like I expected.
Yes, I understand if you don't want to download and execute code like
this. It was just a try to bring this thread fast forward. The
maven-surefire-plugin-hint above was all I needed.
I did the JUnit tests with version 4.8.1 using eclipse and just hit the
run button some times with no error. If I
do it with "mvn clean install" using the command prompt with the
following pom, I got an error after a few hits on enter.
<modelVersion>4.0.0</modelVersion>
<groupId>test</groupId>
<artifactId>maven-file-test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>maven-file-test</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
My code is quite simple. A method that writes a file and another one
that deletes a file.
The first test inside the test class writes the file, the second test
case delete it.
And I know that it may failed because of the underlying platform like
the javadoc told, for example, in FileOutputStream.
After I added a third test case with a loop around writing and deleting
- which is much as faster as I can do it by pressing the
run button inside an IDE ;) - and after I added maven-surefire-plugin to
my pom like you told, I saw that
both executions (IDE and command prompt) ends with an error.
With the IDE after a while also and with the command prompt not as often
as before. The different frequency of the error appearance made me mad.
The next two questens I have to find out are:
1. What does the maven-surefire-plugin exactly do? It still fails, but
not so much like without it.
2. Is there a way to avoid running tests with maven depends on the OS if
I reach a level where
no independent solution exists like loading a C-lib for example, don't
care if it is a good idea?
Your hint let my go in the right direction again.
Thanks!
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]