Return-Path: Delivered-To: apmail-maven-users-archive@www.apache.org Received: (qmail 56209 invoked from network); 1 May 2009 20:28:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 1 May 2009 20:28:09 -0000 Received: (qmail 86105 invoked by uid 500); 1 May 2009 20:28:07 -0000 Delivered-To: apmail-maven-users-archive@maven.apache.org Received: (qmail 85983 invoked by uid 500); 1 May 2009 20:28:06 -0000 Mailing-List: contact users-help@maven.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Maven Users List" Reply-To: "Maven Users List" Delivered-To: mailing list users@maven.apache.org Received: (qmail 85973 invoked by uid 99); 1 May 2009 20:28:06 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 May 2009 20:28:06 +0000 X-ASF-Spam-Status: No, hits=3.3 required=10.0 tests=FB_GET_MEDS,HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of andrew.bayer@gmail.com designates 74.125.46.156 as permitted sender) Received: from [74.125.46.156] (HELO yw-out-1718.google.com) (74.125.46.156) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 May 2009 20:27:58 +0000 Received: by yw-out-1718.google.com with SMTP id 9so1608268ywk.6 for ; Fri, 01 May 2009 13:27:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:from:date:message-id :subject:to:content-type; bh=MQDIvLFS9sv7ngEG0CH2zYn6vraoTCZV8DUfhNvAIMM=; b=KT2oTJqSDN1xPb5Dv+utPK46zUyc7v9mDu4tUtRejvroum3W/8Q4o9jKflQqNMbFOP JOzU/4bAzDCWPcLu7jlt1qP6H7HuPEliirlwNy8tGyd8fj/K8zrsIz87pkR3Lu5/pDOO beLq2qzn6zhIKhXcsEHhie0+co4lCKCtPom6A= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=XD4zMpdZq/8mk/hWzQzhQUeNCI9geLSyj3cpLKm9WZ9j1qR0yvvorWsL1bdKpgVL4b rnhY3GPV4wFdUhJKQP3iiHweLxoVJ+aQWJKFhcii8VEl870L6UggVhhePv89BFIji1hk 0rDfLep8mrOMsELV9m8hG0JHYvZ4ftTGDBWSw= MIME-Version: 1.0 Received: by 10.151.133.5 with SMTP id k5mr6357864ybn.132.1241209657079; Fri, 01 May 2009 13:27:37 -0700 (PDT) From: Andrew Bayer Date: Fri, 1 May 2009 13:27:22 -0700 Message-ID: Subject: Adding a directory to maven-surefire-plugin's To: Maven Users List Content-Type: multipart/alternative; boundary=001e680f1038b3b9cb0468dfa478 X-Virus-Checked: Checked by ClamAV on apache.org --001e680f1038b3b9cb0468dfa478 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi - I'm working on transitioning a large multi-module project from Ant to Maven, and have encountered a truly bizarre use case for Surefire. The unit tests in a number of the modules use a fairly elaborate Junit runner framework developed here - logging, configuration file locations, etc are all determined through the runner. We'd been running each test forked on its own in the existing Ant system - but upon moving to Maven and using fork="once", we discovered that in some cases, tests stepped on each other. However, when we try to run tests using our Junit runner with fork="always", the tests never actually run - we end up with this stacktrace: java.lang.IllegalStateException: Could not find 'conf/' directory in the classpath. In order to find the home directory in the classpath a directory called 'conf/' must be in the root of the classpath and can not be in a jar. at com.cisco.ccbu.infra.Environment.findHomeAbsPathInClasspath(Environment.java:204) at com.cisco.ccbu.infra.Environment.getHomeDirectory(Environment.java:132) at com.cisco.ccbu.infra.Environment.getConfigurationDirectory(Environment.java:160) at com.cisco.ccbu.infra.properties.PropertyManager.init(PropertyManager.java:152) at com.cisco.ccbu.infra.properties.PropertyManager.(PropertyManager.java:106) at com.cisco.ccbu.infra.serviceability.CustomLogMessages.reloadCustomizedMessages(CustomLogMessages.java:123) at com.cisco.ccbu.infra.serviceability.CustomLogMessages.(CustomLogMessages.java:97) at com.cisco.ccbu.infra.serviceability.LogMsg.initLevel(LogMsg.java:211) at com.cisco.ccbu.infra.serviceability.LogMsg.(LogMsg.java:489) at com.cisco.ccbu.infra.serviceability.LogMsg.(LogMsg.java:441) at com.cisco.ccbu.infra.junit.runners.Infrastructure.(Infrastructure.java:191) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at org.junit.internal.requests.ClassRequest.buildRunner(ClassRequest.java:33) at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:28) at org.apache.maven.surefire.junit4.JUnit4TestSet.(JUnit4TestSet.java:45) at org.apache.maven.surefire.junit4.JUnit4DirectoryTestSuite.createTestSet(JUnit4DirectoryTestSuite.java:56) at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.locateTestSets(AbstractDirectoryTestSuite.java:96) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.maven.surefire.booter.SurefireBooter.getTestSets(SurefireBooter.java:448) at org.apache.maven.surefire.booter.SurefireBooter.runSuitesForkPerTestSet(SurefireBooter.java:399) at org.apache.maven.surefire.booter.SurefireBooter.run(SurefireBooter.java:249) at org.apache.maven.plugin.surefire.SurefirePlugin.execute(SurefirePlugin.java:492) The problem here is that the runner for each test gets initialized when fork="always", but our runner depends on there being a directory in the classpath with a "conf" subdirectory. In our builds, there is a target/test-classes/conf directory, so the actual test execution works alright, but the classpath the Surefire plugin itself runs in does not work here. I can't find a way to get a directory with a conf subdirectory onto the maven-surefire-plugin classpath - it needs to be an actual filesystem directory, so I can't just add a jar to maven-surefire-plugin's dependencies. We can prevent it from ever checking for that conf directory in the classpath if we've set a system property to point to a directory with a conf subdir, but since we can't set system properties for the maven process on a per-pom basis, I'm not happy doing that if I can avoid it. And we wouldn't want that system property to be carried over into the actual unit tests - I know Surefire 2.4.3 with Maven 2.0.10 doesn't transfer the Maven process's system properties to the tests, but I can't tell if that's a bug or intended. So yeah - I'm stumped as to what to do about this - does anyone have any ideas? A. --001e680f1038b3b9cb0468dfa478--