You are viewing a plain text version of this content. The canonical link for it is here.
Posted to easyant-commits@incubator.apache.org by "Jean-Louis Boudart (Resolved) (JIRA)" <ji...@apache.org> on 2011/11/14 17:45:52 UTC

[jira] [Resolved] (EASYANT-11) Can't set any Logger / BuildListerner

     [ https://issues.apache.org/jira/browse/EASYANT-11?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jean-Louis Boudart resolved EASYANT-11.
---------------------------------------

       Resolution: Fixed
    Fix Version/s: 0.9

With changes done in EASYANT-38 on easyant's shell script, we seems to be friendly with libraries stored in .ant/lib
                
> Can't set any Logger / BuildListerner
> -------------------------------------
>
>                 Key: EASYANT-11
>                 URL: https://issues.apache.org/jira/browse/EASYANT-11
>             Project: EasyAnt
>          Issue Type: Bug
>          Components: Core
>            Reporter: Jean-Louis Boudart
>            Assignee: Jean-Louis Boudart
>             Fix For: 0.9
>
>         Attachments: stacktrace.jpg, stacktracewitherror.jpg
>
>
> Someone on the ant-user ML has just posted an interresting link about an ant logger measuring execution time and generating charts.
> http://code.google.com/p/antstatistics/
> I downloaded the logger with the required dependencies and put all this stuff in my $HOME/.ant directory.
> Then i just run "easyant -logger -logger de.pellepelster.ant.statistics.AntStatisticsLogger package" like explained in their documentation.
> And here easyant fails with the following message 
> !stacktrace.jpg!
> As you can see with have the stacktrace but not the error message.
> After a few minutes i notice that there was a strange legacy code of ant in EasyAntEngine.java
> {code}
> try {
> 				logger = (BuildLogger) ClasspathUtils.newInstance(configuration
> 						.getLoggerClassname(), EasyAntEngine.class
> 						.getClassLoader(), BuildLogger.class);
> 			} catch (BuildException e) {
> 				System.err.println("The specified logger class "
> 						+ configuration.getLoggerClassname()
> 						+ " could not be used because " + e.getMessage());
> 				throw new RuntimeException();
> 			}
> {code}
> We must refactor how exception are handled here.
> After fixing this first issue i got the whole error :
> !stacktracewitherror.jpg!
> But what happens ? why is it throwing a NoClassDefFound even when i gave him the directory with jars :
> {code}
> easyant package -logger de.pellepelster.ant.statistics.AntStatisticsLogger -lib /path/to/antstatisticslib
> {code}
> It looks like a side effect of #126: Bootstrap mechanism on easyant scripts. If i do the same with easyant 0.7 it works.
> It's definitively a classloader issue.
> In 0.8 we put all jars necessary to run easyant in the java classpath whereas in 0.7 javaclasspath only contains ant-launcher. 
> In 0.7 all other jars was added using -lib argument.
> In 0.8 scripts the command line used to invoke ant looks like this :
> {code}
> "%_JAVACMD%" %ANT_OPTS% %EASYANT_OPTS% -classpath "%EASYANT_BOOTSTRAP_PATH%" "-Dant.home=%ANT_HOME%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% %EASYANT_ARGS% %ANT_CMD_LINE_ARGS%
> {code}
> where EASYANT_BOOTSTRAP_PATH is build with the folliwing syntax :
> {code}
> set EASYANT_BOOTSTRAP_PATH=/path/to/jar1;/path/to/jar2;...;/path/to/jarN
> {code}
> One solution could be to change a bit our scripts to have something like that 
> {code}
> set EASYANT_BOOTSTRAP_PATH=/path/to/jar1 -lib /path/to/jar2 ... -lib /path/to/jarN
> set ANT_LANCHER=/path/to/resolved/ant-launcher.jar
> "%_JAVACMD%" %ANT_OPTS% %EASYANT_OPTS% -classpath "%ANT_LAUNCHER%"  "-Dant.home=%ANT_HOME%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% %EASYANT_ARGS% %ANT_CMD_LINE_ARGS% -lib "%EASYANT_BOOTSTRAP_PATH%"
> {code}
> Any objections ?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira