[ http://jira.codehaus.org/browse/SUREFIRE-165?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_92906 ]
Jesse Kuhnert commented on SUREFIRE-165: ---------------------------------------- I'd resolve this if I had the right perms but the new 2.4-SNAPSHOT version of surefire is compatible up to version 5.5 of TestNG. > TestNG JDK1.4 JavaDoc annotated classes never run ... and now I know why. > ------------------------------------------------------------------------- > > Key: SUREFIRE-165 > URL: http://jira.codehaus.org/browse/SUREFIRE-165 > Project: Maven Surefire > Issue Type: Bug > Components: TestNG support > Affects Versions: 2.0 (2.2 plugin) > Environment: - WinXP > - Maven 2.0.4 (with maven-surefire-plugin 2.2) > Reporter: Davy Toch > Fix For: 2.4 > > Attachments: m2-testng-example-jdk14.zip > > > After a day of trying to find out why JDK1.4 JavaDoc annotated test classes > were never run, I finally found out why: > In > maven-surefire\surefire-providers\surefire-testng\src\main\java\org\apache\maven\surefire\testng\TestNGExecutor.java, > the method testng.runSuitesLocally() is called: > static void executeTestNG( SurefireTestSuite surefireSuite, String > testSourceDirectory, XmlSuite suite, > ReporterManager reporterManager ) > { > ... > // TODO: Doesn't find testng.xml based suites when these are un-commented > // TestNG ~also~ looks for the currentThread context classloader > // ClassLoader oldClassLoader = > Thread.currentThread().getContextClassLoader(); > // Thread.currentThread().setContextClassLoader( > suite.getClass().getClassLoader() ); > testNG.runSuitesLocally(); > //Thread.currentThread().setContextClassLoader( oldClassLoader ); > ... > } > However, in the TestNG 5.1 source file org\testng\TestNG.java, only the > method run() correctly loads the JDK1.4 annotations. So the above class > should call testng.run() and not testng.runSuitesLocally(). > org\testng\TestNG.java: > /** > * Run TestNG. > */ > public void run() { > // lazy scan sourcedirs if needed > if(isJdk14() || JAVADOC_ANNOTATION_TYPE.equals(m_target)) { > > AnnotationConfiguration.getInstance().getAnnotationFinder().addSourceDirs(m_sourceDirs); > } > ... > } > The problem is also still present in the latest 2.3-SNAPSHOT version of the > maven-surefire-plugin. > Included a small example project to illustrate the problem (just run "maven > test"). -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira