Using maven-watcher with external maven install?

I'm working to get the Artifactory plugin working with my maven modules and having difficulty getting it to deploy artifacts.  Our build configurations use an external maven installation of 2.0.9.  When doing a build, the following warning message is logged:

[07:21:26]: Skipping build info collection: Maven build info report doesn't exist.


I believe this is because the 'Maven Watcher' plugin doesn't run after the build completes.  I can't find much documentation on the plugin, but is it necessary to put it into my pom as a dependency if I don't use the built in maven installation?  If I use the bundled version of maven, I do see the Maven Watcher running.  I would rather use the external version of maven if possible.

When I use the built-in maven installation, one of my maven modules (multi-module) fails to deploy with the below error.  I don't know if this is a problem with the artifactory plugin or something specific with my module:

[07:44:21]: [Maven Watcher] starting handling projects
[07:44:21]: [Maven Watcher] building report document...
[07:44:21]: java.lang.reflect.InvocationTargetException
[07:44:21]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

[07:44:21]:...
Caused  by: java.lang.RuntimeException:  org.codehaus.plexus.component.repository.exception.ComponentLookupException:  Unable to lookup component  'org.apache.maven.artifact.factory.ArtifactFactory', it could not be  started

[07:44:21]: at com.jetbrains.maven.watcher.reporter.MavenBuildInfoReporter.getComponent(MavenBuildInfoReporter.java:181)
[07:44:21]: at com.jetbrains.maven.watcher.reporter.MavenBuildInfoReporter.addPluginElement(MavenBuildInfoReporter.java:154)
[07:44:21]: at com.jetbrains.maven.watcher.reporter.MavenBuildInfoReporter.addProjectPart(MavenBuildInfoReporter.java:133)
[07:44:21]: at com.jetbrains.maven.watcher.reporter.MavenBuildInfoReporter.generateReport(MavenBuildInfoReporter.java:74)
[07:44:21]: at com.jetbrains.maven.watcher.reporter.MavenBuildInfoReporter.generateReport(MavenBuildInfoReporter.java:51)
[07:44:21]: at com.jetbrains.maven.watcher.Watcher.onBuildFinished(Watcher.java:20)
[07:44:21]: ... 26 more

10 comments

Hi, Chris.

This seems to be a problem in Maven Watcher itself. Maven Watcher is a part of TeamCity. You don't need to depend on it in your projects. It's integrated into Maven in runtime automatically.
However it's quite strange to see this problem since we tested the Watcher with every Maven release since 2.0.4, and with 2.0.9 it should work just fine as well.

Could you please ensure that the Maven installation you're using is really of 2.0.9

Thank you.

0

Our installation is 2.0.9.  In the lib directory I have the following:

# ls -asl
total 2168
   4 drwxr-xr-x 2 tcbuild prosdev    4096 Jul 26 07:38 .
   4 drwxr-xr-x 6 tcbuild prosdev    4096 Jul 26 07:38 ..
2160 -rw-r--r-- 1 tcbuild prosdev 2205737 Jul 26 07:38 maven-2.0.9-uber.jar

Does TeamCity need to pull anything from the main maven repo?  We have an internal repo that is locked down and doesn't allow retrieval of anything from outside the network.

Thanks,

  Chris

0

No, it doesn't.

Could you please send me the build log.

0

Hi, I've sent the build log to your email account.  Looking through the log, at the very beginning, I *do* see a reference to the maven-watcher agent but no mention of it later:

[09:25:55]: Using watcher: /localbuild/TeamCityAgent/plugins/mavenPlugin/maven-watcher/maven-watcher-agent.jar
[09:25:55]: MAVEN_OPTS =   -javaagent:/localbuild/TeamCityAgent/plugins/mavenPlugin/maven-watcher/maven-watcher-agent.jar ...


Thanks,
  Chris Schmidt
0

Thank you for the log. I see a different problem in there - watcher simply doesn't start.
Do you use mavenrc scripts?

0

No, we typically call the mvn shell script.  I haven't heard about mavenrc before now, I'll have to look into it.

0

/etc/mavenrc and ~/.mavenrc are called by mvn prior to main Maven code execution. Usually they are created by developers to control Maven's JVM by setting MAVEN_OPTS. If MAVEN_OPTS is simply overriden in those scripts then the initial settings made by TeamCity (including watcher settings) are lost. Please check it.

Thank you.

0

Yes, that was it.  A hardcoded MAVEN_OPTS was in our mvn shell script.  Thank you for the help.  It's greatly appreciated.

0

OK, I'm glad this works. By the way, if you want to define custom JVM setting you can do it inside the build configuration in TeamCity.

However, the initial problem with the exception reported is something absolutely different. Does it still appear?

0

It does not.  My guess is that the overridden maven_opts was impacting the artifactory plugin as well.  Once that was removed
the deployments to artifactory started to work without any issues.

0

Please sign in to leave a comment.