Maven2 runner and antrun optional task

Hello.

I have a Maven2 project and when built from command line, all is good.

When it is built using TeamCity, however, there's a problem:

Build errors

[14:20:34]: [ERROR] BUILD ERROR
[14:20:34]: [INFO] ------------------------------------------------------------------------
[14:20:34]: [INFO] Error executing ant tasks
[14:20:34]: Embedded error: Could not create task or type of type: replaceregexp.
[14:20:34]: Ant could not find the task or a class this task relies upon.
[14:20:34]: This is common and has a number of causes; the usual
[14:20:34]: solutions are to read the manual pages then download and
[14:20:34]: install needed JAR files, or fix the build file:
[14:20:34]: - You have misspelt 'replaceregexp'.
[14:20:34]:    Fix: check your spelling.
[14:20:34]: - The task needs an external JAR file to execute
[14:20:34]:      and this is not found at the right place in the classpath.
[14:20:34]:    Fix: check the documentation for dependencies.
[14:20:34]:    Fix: declare the task.
[14:20:34]: - The task is an Ant optional task and the JAR file and/or libraries
[14:20:34]:      implementing the functionality were not found at the time you
[14:20:34]:      yourself built your installation of Ant from the Ant sources.
[14:20:34]:    Fix: Look in the ANT_HOME/lib for the 'ant-' JAR corresponding to the
[14:20:34]:      task and make sure it contains more than merely a META-INF/MANIFEST.MF.
[14:20:34]:      If all it contains is the manifest, then rebuild Ant with the needed
[14:20:34]:      libraries present in ${ant.home}/lib/optional/ , or alternatively,
[14:20:34]:      download a pre-built release version from apache.org
[14:20:34]: - The build file was written for a later version of Ant
[14:20:34]:    Fix: upgrade to at least the latest release version of Ant
[14:20:34]: - The task is not an Ant core or optional task
[14:20:34]:      and needs to be declared using <taskdef>.
[14:20:34]: - You are attempting to use a task defined using
[14:20:34]:     <presetdef> or <macrodef> but have spelt wrong or not
[14:20:34]:    defined it at the point of use
[14:20:34]: Remember that for JAR files to be visible to Ant tasks implemented
[14:20:34]: in ANT_HOME/lib, the files must be in the same directory or on the
[14:20:34]: classpath
[14:20:34]: Please neither file bug reports on this problem, nor email the
[14:20:34]: Ant mailing lists, until all of these causes have been explored,
[14:20:34]: as this is not an Ant bug.
[14:20:34]: [DEBUG] Trace
[14:20:34]: org.apache.maven.lifecycle.LifecycleExecutionException: Error executing ant tasks
[14:20:34]: at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:583)
[14:20:34]: at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:499)
[14:20:34]: at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:478)
[14:20:34]: at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330)
[14:20:34]: at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291)
[14:20:34]: at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
[14:20:34]: at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
[14:20:34]: at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
[14:20:34]: at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
[14:20:34]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[14:20:34]: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[14:20:34]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[14:20:34]: at java.lang.reflect.Method.invoke(Method.java:597)
[14:20:34]: at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
[14:20:34]: at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
[14:20:34]: at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
[14:20:34]: at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
[14:20:34]: Caused by: org.apache.maven.plugin.MojoExecutionException: Error executing ant tasks
[14:20:34]: at org.apache.maven.plugin.antrun.AbstractAntMojo.executeTasks(AbstractAntMojo.java:114)
[14:20:34]: at org.apache.maven.plugin.antrun.AntRunMojo.execute(AntRunMojo.java:83)
[14:20:34]: at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451)
[14:20:34]: at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558)
[14:20:34]: ... 16 more
[14:20:34]: Caused by: Could not create task or type of type: replaceregexp.
[14:20:34]: Ant could not find the task or a class this task relies upon.
[14:20:34]: This is common and has a number of causes; the usual
[14:20:34]: solutions are to read the manual pages then download and
[14:20:34]: install needed JAR files, or fix the build file:
[14:20:34]: - You have misspelt 'replaceregexp'.
[14:20:34]:    Fix: check your spelling.
[14:20:34]: - The task needs an external JAR file to execute
[14:20:34]:      and this is not found at the right place in the classpath.
[14:20:34]:    Fix: check the documentation for dependencies.
[14:20:34]:    Fix: declare the task.
[14:20:34]: - The task is an Ant optional task and the JAR file and/or libraries
[14:20:34]:      implementing the functionality were not found at the time you
[14:20:34]:      yourself built your installation of Ant from the Ant sources.
[14:20:34]:    Fix: Look in the ANT_HOME/lib for the 'ant-' JAR corresponding to the
[14:20:34]:      task and make sure it contains more than merely a META-INF/MANIFEST.MF.
[14:20:34]:      If all it contains is the manifest, then rebuild Ant with the needed
[14:20:34]:      libraries present in ${ant.home}/lib/optional/ , or alternatively,
[14:20:34]:      download a pre-built release version from apache.org
[14:20:34]: - The build file was written for a later version of Ant
[14:20:34]:    Fix: upgrade to at least the latest release version of Ant
[14:20:34]: - The task is not an Ant core or optional task
[14:20:34]:      and needs to be declared using <taskdef>.
[14:20:34]: - You are attempting to use a task defined using
[14:20:34]:     <presetdef> or <macrodef> but have spelt wrong or not
[14:20:34]:    defined it at the point of use
[14:20:34]: Remember that for JAR files to be visible to Ant tasks implemented
[14:20:34]: in ANT_HOME/lib, the files must be in the same directory or on the
[14:20:34]: classpath
[14:20:34]: Please neither file bug reports on this problem, nor email the
[14:20:34]: Ant mailing lists, until all of these causes have been explored,
[14:20:34]: as this is not an Ant bug.
[14:20:34]: at org.apache.tools.ant.UnknownElement.getNotFoundException(UnknownElement.java:493)
[14:20:34]: at org.apache.tools.ant.UnknownElement.makeObject(UnknownElement.java:391)
[14:20:34]: at org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:158)
[14:20:34]: at org.apache.tools.ant.Task.perform(Task.java:363)
[14:20:34]: at org.apache.tools.ant.Target.execute(Target.java:341)
[14:20:34]: at org.apache.maven.plugin.antrun.AbstractAntMojo.executeTasks(AbstractAntMojo.java:108)
[14:20:34]: ... 19 more




 


Maven2 runner I'm using has custom home directory. I.e., it should be using the external maven, the same one that I'm running from command line. But clearly, something is different between these two cases.

Here is teamcity-agent.log:

----------------------------------------- [ studynet::maven #5 (buildId = 5) ] ----------------------------------------- [2009-02-13 16:15:14,570]   INFO - nner2.OsProcessHandlerListener - c:\java\maven\bin\mvn.bat -f C:\dev\CR\TeamCity\buildAgent\wor k\becf40d683bdaf03\pom.xml -B -s c:\java\maven\conf\settings.xml -U clean install



 


Is there anywhere else I can look to determine what's wrong?

Thanks!

2 comments
Comment actions Permalink

Hello Yuri,

if c:\java\maven is the proper location for your custom Maven, then please
ensure that the agent has the same environment as your maven does when you
start it from the command line. Particularly, the value of ANT_HOME is crucial.

The difference for example may be caused by running the agent by a different
user, or as a service.


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


0
Comment actions Permalink

Thanks. There were several problems: another user (SYSTEM), and mavenrc_pre.bat actually overwritten MAVEN_OPTS to set -Xmx parameter.

0

Please sign in to leave a comment.