[jboss-dev-forums] [Design of JBoss Portal] - Maven Migration Status

wesleyhales do-not-reply at jboss.com
Tue Sep 11 21:29:09 EDT 2007


So I have a working Maven build (minus this problem) with the common module. I have also created the JbossPortal and JbossModules pom ready for all kinds of inheritance fun ;)

The problem I am currently having is that it looks like maven does not allow us to set System Properties for use in the JVM from within a pom.xml file. i.e.
when we set:

  | <pathelement location="${build.resources}"/>
  | 
(in the old ant build.xml)

and use it in ImplodeTestCase as:

  | File foo_sarDir = new File(System.getProperty("build.resources") + "/test/implode/foo.sar");
  | assertTrue(foo_sarDir.exists());
  | 
...the system property returns null and the test fails using maven. I also tried setting it via the maven-ant plugin to no avail.

You can read any system property in the pom.xml (see this properties guide) but you cannot write to them via the pom.

This is discussed on the maven mail list here.
The suggested way is to pass a system property in with "mvn install -Dmyprop=whatever" on the command line.

I have 2 possible solutions for this problem, but wanted to get input:
1.) Create a .bat & .sh file to add the parameter (but we still have to dynamically detect the file path to the resources or maybe we could use a relative path)
2.) or use code like this:

  | File f = new File("");
  | String path = f.getAbsolutePath();
  | File foo_sarDir = new File(path + "/target/test-classes/implode/foo.sar");
  | 

this also occurs in LocaleFormatTestCase and URLNavigatorTestCase

Let me know your thoughts,


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4083231#4083231

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4083231



More information about the jboss-dev-forums mailing list