In my 15 hour quest to stubornly solve this I have not thanked everyone who
has come with their useful remarks. This is a very impressive forum.

Kristian: As I wrote I have tried with version 4.81 and the only dependency
I use now is 
<dependencies>
      <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>[4.8.1]</version>
          <scope>test</scope>
      </dependency>
  </dependencies>
I have removed all other source and test files.
The brackets force it to use this version. TestNG needs Junit 3.8.1 but I
removed both to just see if I can compile this simple test placed under
C:\Users\Gogirl\_MavenProjects\mavenHelloWorld\src\test\java\com\mycompany\app
created by the quickstart archetype. Test file:

package com.mycompany.app;
import org.junit.*; 
// by FYICenter.com
public class TestJunit4.8{ 
 @Test 
    public void testHello() {
        String message = "Hello World!";
        Assert.assertEquals(12, message.length());
        System.out.println("I am running Junit 4.8.2");
    }
   
}
mvn test won't compile now and claims that it expect a {
I have downloaded my own junit 4.8.2 and its in my classpath and i could
compile and run it fine with the cmd.exe. 

I have a clean machine with the latest downloaded versions. 
here is the complete pom:

<project xmlns="http://maven.apache.org/POM/4.0.0";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.mycompany.app</groupId>
  <artifactId>mavenHelloWorld</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>mavenHelloWorld</name>
  <url>http://maven.apache.org</url>

  <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>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.12</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</project>

It's really a bare bones project now.Although these articles were
particularly helpful
http://stackoverflow.com/questions/2021771/surefire-is-not-picking-up-junit-4-tests?sort=newest#sort-top
http://stackoverflow.com/questions/5845990/maven-3-and-junit-4-compilation-problem-package-org-junit-does-not-exist
http://stackoverflow.com/questions/739076/why-cant-java-find-the-junit-framework

It has not explained the erratic behaviour i get. I haven't tried github but
will look into it thx.

--
View this message in context: 
http://maven.40175.n5.nabble.com/Junit-ignored-by-Maven-tp5497051p5497535.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to