ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tiago Espinha <ti...@espinhas.net>
Subject Problem with the classpath
Date Thu, 06 Aug 2009 22:27:04 GMT
Hello everyone,

We at Apache Derby are using Ant to manage our build process but I
have just run into an annoying problem that is being hard to overcome.
Having tried pretty much everything we could think of, I decided to
ask for help with the more knowledgeable crew.

The symptoms are very simple: if we build our main target **without**
the classpath environment variable set, everything compiles just fine
and we find no issues at all. The problem occurs when we are trying to
compile a specific code tree and our classpath (again, the env.
variable) is set to a different version's code tree. This raises a
failure in an ant task that we believe to be classpath-related.

The task in question runs the following code to dynamically load classes:
--------------8<-----------------
String bundleName = "org.apache.derby.loc.m" + index;
ResourceBundle bundle = ResourceBundle.getBundle(bundleName, Locale.ENGLISH);
--------------8<-----------------

The problem ends up being that this task is seeing the environment
classpath and we were hoping to avoid this, because otherwise it will
attempt to load classes that it shouldn't.

Our target looks like the following:
<target name="runmessagecheck">
    <taskdef
      name="runMessageBundleTest"
      classname="org.apache.derbyBuild.MessageBundleTest"
      classpath="/Users/tiago/Desktop/Derby/CodeTenFive/classes"
    />
    <runMessageBundleTest/>
  </target>

I have manually changed the classpath to an absolute path to avoid
running into any problems with variables, but clearly that classpath
isn't reaching the task. To confirm this, I printed the
'java.class.path' property inside the task and alas: the classpath I
get in there is the one contained in the environment variable and not
the one defined in the task definition.

I have also tried the build.sysclasspath property (defining it to
ignore). I tried defining it project-wide, as a property using -D and
even on ant.properties, all with no luck.

Finally, we also attempted to use
	<classpath>
		<path refid="compile.classpath"/>
		<pathelement location="/Users/tiago/Desktop/Derby/CodeTenFive/classes"/>
	</classpath>
inside the above target, at the same level of the taskdef, but also
with no luck.

Do you have any idea at all of what we might be doing wrong, or simply
how to overcome this issue? Any suggestions are appreciated.

Thank you.

Tiago Espinha

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message