Ant problems within Maven2 build

I have a multi-module maven project that builds fine in IDEA and on the command line but when running on TeamCity:

[13:00:46]: [INFO] [clean:clean]
[13:00:46]: [INFO] ------------------------------------------------------------------------
[13:00:46]: [ERROR] FATAL ERROR
[13:00:46]: [INFO] ------------------------------------------------------------------------
[13:00:46]: [INFO] org.apache.tools.ant.util.FileUtils.close(Ljava/io/InputStream;)V
[13:00:46]: [INFO] ------------------------------------------------------------------------
[13:00:46]: [INFO] Trace
[13:00:46]: java.lang.NoSuchMethodError: org.apache.tools.ant.util.FileUtils.close(Ljava/io/InputStream;)V
[13:00:46]: at org.apache.tools.ant.ComponentHelper.getDefaultDefinitions(ComponentHelper.java:737)
[13:00:46]: at org.apache.tools.ant.ComponentHelper.initTasks(ComponentHelper.java:681)
[13:00:46]: at org.apache.tools.ant.ComponentHelper.initDefaultDefinitions(ComponentHelper.java:270)
[13:00:46]: at org.apache.maven.plugin.antrun.components.AntTargetConverter.initDefinitions(AntTargetConverter.java:189)
[13:00:46]: at org.apache.maven.plugin.antrun.components.AntTargetConverter.processConfiguration(AntTargetConverter.java:109)
[13:00:46]: at org.apache.maven.plugin.antrun.components.AntTargetConverter.fromConfiguration(AntTargetConverter.java:83)
[13:00:46]: at org.codehaus.plexus.component.configurator.converters.ComponentValueSetter.configure(ComponentValueSetter.java:247)
[13:00:46]: at org.codehaus.plexus.component.configurator.converters.composite.ObjectWithFieldsConverter.processConfiguration(ObjectWithFieldsConverter.java:137)
[13:00:46]: at org.codehaus.plexus.component.configurator.BasicComponentConfigurator.configureComponent(BasicComponentConfigurator.java:56)
[13:00:46]: at org.apache.maven.plugin.DefaultPluginManager.populatePluginFields(DefaultPluginManager.java:1151)
[13:00:46]: at org.apache.maven.plugin.DefaultPluginManager.getConfiguredMojo(DefaultPluginManager.java:618)
[13:00:46]: at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:425)
[13:00:46]: at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
[13:00:46]: at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480)
[13:00:46]: at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:459)
[13:00:46]: at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
[13:00:46]: at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
[13:00:46]: at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
[13:00:46]: at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:333)
[13:00:46]: at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:126)
[13:00:46]: at org.apache.maven.cli.MavenCli.main(MavenCli.java:282)
[13:00:46]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[13:00:46]: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[13:00:46]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[13:00:46]: at java.lang.reflect.Method.invoke(Method.java:597)
[13:00:46]: at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
[13:00:46]: at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
[13:00:46]: at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
[13:00:46]: at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
[13:00:46]: [INFO] ------------------------------------------------------------------------
[13:00:46]: [INFO] Total time: 5 seconds
[13:00:46]: [INFO] Finished at: Fri Jun 12 13:00:46 CDT 2009
[13:00:47]: [INFO] Final Memory: 42M/348M
[13:00:47]: [INFO] ------------------------------------------------------------------------
[13:00:47]: Process exit code: 1
[13:00:47]: Number of processed tests: 0

[13:00:47]: Build finished


I read online that there could be an ant.jar conflict. Is that possible?

4 comments
Comment actions Permalink

Hello Vincent,

Looks like antrun plugin is using a different Ant.
What Ant version is installed on your agent?
Also please check whether the same thing appears whe you run Maven manually

I have a multi-module maven project that builds fine in IDEA and on
the command line but when running on TeamCity:

:

:
----------------------------------------------------------------------
--

: FATAL ERROR

: +
----------------------------------------------------------------------
--+

: +
org.apache.tools.ant.util.FileUtils.close(Ljava/io/InputStream;)V+

: +
----------------------------------------------------------------------
--+

: Trace

: +java.lang.NoSuchMethodError:
org.apache.tools.ant.util.FileUtils.close(Ljava/io/InputStream;)V+

: +at
org.apache.tools.ant.ComponentHelper.getDefaultDefinitions(ComponentHe
lper.java:737)+

: +at
org.apache.tools.ant.ComponentHelper.initTasks(ComponentHelper.java:68
1)+

: +at
org.apache.tools.ant.ComponentHelper.initDefaultDefinitions(ComponentH
elper.java:270)+

: +at
org.apache.maven.plugin.antrun.components.AntTargetConverter.initDefin
itions(AntTargetConverter.java:189)+

: +at
org.apache.maven.plugin.antrun.components.AntTargetConverter.processCo
nfiguration(AntTargetConverter.java:109)+

: +at
org.apache.maven.plugin.antrun.components.AntTargetConverter.fromConfi
guration(AntTargetConverter.java:83)+

: +at
org.codehaus.plexus.component.configurator.converters.ComponentValueSe
tter.configure(ComponentValueSetter.java:247)+

: +at
org.codehaus.plexus.component.configurator.converters.composite.Object
WithFieldsConverter.processConfiguration(ObjectWithFieldsConverter.jav
a:137)+

: +at
org.codehaus.plexus.component.configurator.BasicComponentConfigurator.
configureComponent(BasicComponentConfigurator.java:56)+

: +at
org.apache.maven.plugin.DefaultPluginManager.populatePluginFields(Defa
ultPluginManager.java:1151)+

: +at
org.apache.maven.plugin.DefaultPluginManager.getConfiguredMojo(Default
PluginManager.java:618)+

: +at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPlugin
Manager.java:425)+

: +at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defau
ltLifecycleExecutor.java:539)+

: +at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLif
ecycle(DefaultLifecycleExecutor.java:480)+

: +at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Defaul
tLifecycleExecutor.java:459)+

: +at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHand
leFailures(DefaultLifecycleExecutor.java:311)+

: +at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegment
s(DefaultLifecycleExecutor.java:278)+

: +at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLif
ecycleExecutor.java:143)+

: +at
org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:333)+

: +at
org.apache.maven.DefaultMaven.execute(DefaultMaven.java:126)+

: at org.apache.maven.cli.MavenCli.main(MavenCli.java:282)

: +at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)+

: +at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.j
ava:39)+

: +at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess
orImpl.java:25)+

: at java.lang.reflect.Method.invoke(Method.java:597)

: +at
org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)+

: +at
org.codehaus.classworlds.Launcher.launch(Launcher.java:255)+

: +at
org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)+

: +at
org.codehaus.classworlds.Launcher.main(Launcher.java:375)+

:
----------------------------------------------------------------------
--

: Total time: 5 seconds

: Finished at: Fri Jun 12 13:00:46 CDT 2009

: Final Memory: 42M/348M

:
----------------------------------------------------------------------
--

: Process exit code: 1

: Number of processed tests: 0

: Build finished

I read online that there could be an ant.jar conflict. Is that
possible?

---
Original message URL:
http://www.jetbrains.net/devnet/message/5239978#5239978

--
Sergey Anchipolevsky
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


0
Comment actions Permalink

I am definitely able to build it without an issue on the command line. Still using TC 3.1.x and I tried setting both ANT_HOME (1.7.1) and MAVEN_HOME (2.0.10) to new location with no luck.
ant-contrib jar depends on ant 1.5 but that seems true in both enviroments. I plan to keep looking into it today.

0
Comment actions Permalink

Hello Vincent,

Did you try to run manually exactly the same command line that is executed
by TeamCity?
You may find it in the teamcity-agent.log.
Also you should ensure that variables PATH and MAVEN_OPTS are also the same.
Their values are shown in the top of the build log.

The user under which the command is executed may also be affecting.
Is the agent installed on Windows? If yes is it running as a service?
Try it in both service and non-service mode.

I am definitely able to build it without an issue on the command line.
Still using TC 3.1.x and I tried setting both ANT_HOME (1.7.1) and
MAVEN_HOME (2.0.10) to new location with no luck.

ant-contrib jar depends on ant 1.5 but that seems true in both
enviroments. I plan to keep looking into it today.

---
Original message URL:
http://www.jetbrains.net/devnet/message/5240093#5240093

--
Sergey Anchipolevsky
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


0
Comment actions Permalink

We were having the exact same error. It was not find the classpath for ant task.
The issue was because we were using an Environment Variable for the class path and when we updated TeamCity it updated Maven and the updated Maven would not accept a environment variable that was all lower case. As soon as we make the variable in all UPPERCASE it started working.

0

Please sign in to leave a comment.