Hi, Johan Iskandar schrieb:
Hi,While I was running this command "D:/proyek/mvn verify", I was hoping to find my surefire tests runs having in one of it's classpaths the path "D:/proyek/proyek-core/target/classes".
you can run with 'mvn -x ...' to enable verbose debug output. Maven then logs the classpaths it creates.
I tested this by invoking the code in one of it's test classes:
==========
URL url = ClassLoader.getSystemResource("file-to-find.xml");
String file = url==null?null:url.getFile(); ========== But only to find
that the variable file was null;
you are using the wrong classloader. You should use Thread.getContextClassLoader() or Class.getClassLoader(). See this thread for an example [1]
-Tim[1] http://www.nabble.com/Problems-with-loading-non-Java-resources-from-classpath-in-JUnit--tests-tf3734983s177.html#a10599455
I made sure the existence of the "D:/proyek/proyek-core/target/classes/file-to-find.xml". Is there anyway that I could do in the pom.xml file or any other maven configs to actually adjust the classpath. Cuz, I'd prefer not to declare it in the mvn command or the shell environment.. Thanks, Johan Here's my pom: <?xml version="1.0" encoding="UTF-8"?> <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/maven-v4_0_0.xsd"> <parent> <artifactId>proyek</artifactId> <groupId>com.pro</groupId> <version>1.0-SNAPSHOT</version> </parent> <packaging>jar</packaging> <modelVersion>4.0.0</modelVersion> <groupId>com.pro.core</groupId> <artifactId>proyek-core</artifactId> <name>proyek-core</name> <version>1.0-SNAPSHOT</version> <url>http://maven.apache.org</url> </project> Hi, While I was running this command "D:/proyek/mvn verify", I was hoping to find my surefire tests runs having in one of it's classpaths the path "D:/proyek/proyek-core/target/classes". I tested this by invoking the code in one of it's test classes: ========== URL url = ClassLoader.getSystemResource("file-to-find.xml"); String file = url==null?null:url.getFile(); ========== But only to find that the variable file was null; I made sure the existence of the "D:/proyek/proyek-core/target/classes/file-to-find.xml". Is there anyway that I could do in the pom.xml file or any other maven configs to actually adjust the classpath. Cuz, I'd prefer not to declare it in the mvn command or the shell environment.. Thanks, Johan Here's my pom: <?xml version="1.0" encoding="UTF-8"?> <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/maven-v4_0_0.xsd"> <parent> <artifactId>proyek</artifactId> <groupId>com.pro</groupId> <version>1.0-SNAPSHOT</version> </parent> <packaging>jar</packaging> <modelVersion>4.0.0</modelVersion> <groupId>com.pro.core</groupId> <artifactId>proyek-core</artifactId> <name>proyek-core</name> <version>1.0-SNAPSHOT</version> <url>http://maven.apache.org</url> </project> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
