ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@yahoo.com>
Subject Re: How to set system properties (-D) from a ant task
Date Fri, 10 Oct 2003 20:10:39 GMT
Hmm, interesting.  Without digging too deep into why
this happens, seems like you could do a few things to
correct it:

in your Ant script, for kicks, add 

<echo
message="log4j.configuration=${log4j.configuration}"
/>

This will verify that the property is in your Ant
Project.  If it has been "moved" from the System
properties to your Ant Project, it should be small
work to get back into the System properties:

System.getProperties.setProperty("log4j.configuration",
//cast included for context:
 ((JCSCTask)this).getProject().getProperty(
 "log4j.configuration"));

Before you do that, you might, within your Java task,
double-check the property is not set and you are not
experiencing some other problem...

-Matt

--- Ralph Jocham <rjocham72@yahoo.com> wrote:
> This is my jcsc.bat file
> 
> java -Xmx64m -cp %CP_JCSC% -Djcsc.home=%JCSC_HOME%
> -Dlog4j.configuration=jcsc.log4j
> rj.tools.jcsc.JavaCodingStandardChecker %1 %2 %3 %4
> %5
> %6 %7 %8 %9
> 
> which launches jcsc. Jcsc also has a Ant task but
> since I do not pass in the log4j.configuration I get
> the following Ant output:
> 
> $ ant jcsc
> [...]
> Buildfile: build.xml
> log4j:WARN No appenders could be found for logger
> (rj.tools.jcsc.ui.RulesDialog).
> log4j:WARN Please initialize the log4j system
> properly.
> 
> jcsc:
>    [delete] Deleting 232 files from 
> 
> I changed the ant script to include that log4j
> property but still no success.
> 
> "$JAVACMD" -classpath "$LOCALCLASSPATH"
> -Dlog4j.configuration=jcsc.log4
> -Dant.home="${ANT_HOME}" $ANT_OPTS
> org.apache.tools.ant.Main $ANT_ARGS "$@"
> 
> What am I missing???
> 
> Thanks,
> Ralph
> 
> 
> 
> 
> --- Matt Benson <gudnabrsam@yahoo.com> wrote:
> > I don't know if I understand what you want to do. 
> > You
> > want your Task to set a Project property?  A
> System
> > property?  As I understand it, the -D stuff is
> > passed
> > to the JVM to be used as a system property, then
> Ant
> > copies all system properties into the project.
> > 
> > -Matt
> > 
> > --- Ralph Jocham <rjocham72@yahoo.com> wrote:
> > > Hi,
> > > I am facing the following problem. My program
> uses
> > > log4j and when the program is launched using a
> .sh
> > > or
> > > .bat file I pass in the log4j config file with 
> > > 
> > > -Dlog4j.configuration=jcsc.log4j
> > > 
> > > which works fine. However, my application
> > > (http://jcsc.sourceforge.net) also provides a
> Ant
> > > task. How can I pass in a -D property from my
> ant
> > > task. I do not want to create a new attribute
> for
> > my
> > > JCSC task. The Ant documentation didn't help.
> > > 
> > > Any help or advise is appreciated.
> > > 
> > > Thanks,
> > > Ralph
> > > 
> > > __________________________________
> > > Do you Yahoo!?
> > > The New Yahoo! Shopping - with improved product
> > > search
> > > http://shopping.yahoo.com
> > > 
> > >
> >
>
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > > user-unsubscribe@ant.apache.org
> > > For additional commands, e-mail:
> > > user-help@ant.apache.org
> > > 
> > 
> > 
> > __________________________________
> > Do you Yahoo!?
> > The New Yahoo! Shopping - with improved product
> > search
> > http://shopping.yahoo.com
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > user-unsubscribe@ant.apache.org
> > For additional commands, e-mail:
> > user-help@ant.apache.org
> > 
> 
> 
> __________________________________
> Do you Yahoo!?
> The New Yahoo! Shopping - with improved product
> search
> http://shopping.yahoo.com
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 


__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

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


Mime
View raw message