# Maven plugin install task not being called

**URL:** <https://discuss.gradle.org/t/maven-plugin-install-task-not-being-called/6994>\
**Category:** Old Forum Archive\
**Created:** [March 2, 2012, 10:26am UTC](https://discuss.gradle.org/t/maven-plugin-install-task-not-being-called/6994 "2012-03-02T10:26:00Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![damonkohler](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/damonkohler/32/679_2.png) [@damonkohler](https://discuss.gradle.org/u/damonkohler)\
**Post date:** [March 2, 2012, 10:26am UTC](https://discuss.gradle.org/t/maven-plugin-install-task-not-being-called/6994/1 "2012-03-02T10:26:00Z")

</div>

I have a multi-project build that’s laid out like this:

rosjava\_core/build.gradle rosjava\_core/rosjava/build.gradle rosjava\_core/rosjava\_bootstrap/build.gradle

rosjava depends on rosjava\_bootstrap.

I’d like to deploy the artifacts to my .m2 cache. When I run gradle install, however, the install task is skipped for the rosjava\_bootstrap project (it gets as far as rosjava\_boostrap:jar) and the rosjava:compileJava task is started. The rosjava project depends on some artifacts in my .m2 cache that depend on rosjava\_bootstrap being in the .m2 cache. So, the build fails.

I don’t understand why the rosjava\_bootstrap:install task isn’t being called immediately after rosjava\_bootstrap:jar? If I call gradle rosjava\_boostrap:install, it executes as expect.

I believe my question on stackoverflow ([http://stackoverflow.com/questions/9483924/gradle-eclipse-plugin](http://stackoverflow.com/questions/9483924/gradle-eclipse-plugin)) may also have something to do with this.

The code and build scripts are visible here: [http://code.google.com/r/damonkohler-rosjava-unstable/source/browse](http://code.google.com/r/damonkohler-rosjava-unstable/source/browse)

---

<div class="post-metadata">

**Author:** ![damonkohler](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/damonkohler/32/679_2.png) [@damonkohler](https://discuss.gradle.org/u/damonkohler)\
**Post date:** [March 2, 2012, 2:31pm UTC](https://discuss.gradle.org/t/maven-plugin-install-task-not-being-called/6994/2 "2012-03-02T14:31:00Z")

</div>

I added a hack to rosjava/build.gradle that fixes this problem:

```gradle
afterEvaluate {
  classes.dependsOn project(':rosjava_bootstrap').tasks.install
}

```

However, I still have issues with eclipse generation (as described in detail on stackoverflow). So, I think this is probably the wrong solution.

---

<div class="post-metadata">

**Author:** ![Peter\_Niederwieser](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@Peter\_Niederwieser](https://discuss.gradle.org/u/Peter_Niederwieser)\
**Post date:** [March 5, 2012, 12:49am UTC](https://discuss.gradle.org/t/maven-plugin-install-task-not-being-called/6994/3 "2012-03-05T00:49:00Z")

</div>

> I don’t understand why the rosjava\_bootstrap:install task isn’t being called immediately after rosjava\_bootstrap:jar?

Probably because there is no task dependency that tells Gradle to do so.

I don’t have the full picture, but it seems like you should exclude rosjava\_bootstrap when declaring a dependency from rosjava on that other module in the .m2 cache. Then you might not even have to install rosjava\_bootstrap to the .m2 cache - at least not for building rosjava. The project dependency from rosjava on rosjava\_bootstrap is enough to get the latter on the former’s class path.

---

<div class="post-metadata">

**Author:** ![damonkohler](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/damonkohler/32/679_2.png) [@damonkohler](https://discuss.gradle.org/u/damonkohler)\
**Post date:** [March 5, 2012, 4:15pm UTC](https://discuss.gradle.org/t/maven-plugin-install-task-not-being-called/6994/4 "2012-03-05T16:15:00Z")

</div>

Thanks for the help. Perhaps I don’t quite understand your suggestion, but I tried removing the dependency on rosjava\_bootstrap from rosjava. As expected, the build still fails like so (I removed logging about irrelevant packages):

```gradle
~/ros/workspace/rosjava_core$ gradle clean install
:rosjava:clean
:rosjava_bootstrap:clean
:rosjava:compileJava
  FAILURE: Build failed with an exception.
  * What went wrong:
Could not resolve all dependencies for configuration ':rosjava:compile'.
> Could not find group:ros.rosjava_core, module:rosjava_bootstrap, version:0.0.0-SNAPSHOT.
  Required by:
      ros.rosjava_core:rosjava:0.0.0-SNAPSHOT > ros:message.std_msgs:0.0.0-SNAPSHOT
      ros.rosjava_core:rosjava:0.0.0-SNAPSHOT > ros:message.rosgraph_msgs:0.0.0-SNAPSHOT
  BUILD FAILED

```

std\_msgs and rosgraph\_msgs are installed in my .m2 cache and have a pom that specifies a dependency on rosjava\_bootstrap. So, rosjava has a transitive dependency on rosjava\_bootstrap through std\_msgs and rosgraph\_msgs.

Maybe I’m going about this all wrong. I’m open to suggestions about how to do this in the most gradle-y way possible. However, I’d like to avoid converting std\_msgs and rosgraph\_msgs to gradle for the moment.

---

<div class="post-metadata">

**Author:** ![Peter\_Niederwieser](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@Peter\_Niederwieser](https://discuss.gradle.org/u/Peter_Niederwieser)\
**Post date:** [March 5, 2012, 4:29pm UTC](https://discuss.gradle.org/t/maven-plugin-install-task-not-being-called/6994/5 "2012-03-05T16:29:00Z")

</div>

You have to exclude ‘rosjava\_bootstrap’ when you bring in ‘std\_msgs’ and ‘rosgraph\_msgs’. You are already getting ‘rosjava\_bootstrap’ from the project dependency, so there is no need to also get it from the local Maven repository. Something like:

```gradle
dependencies {
  compile("xxx:std_msgs:1.0") {
    exclude module: "rosjava_bootstrap"
  }
}

```

---

<div class="post-metadata">

**Author:** ![damonkohler](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/damonkohler/32/679_2.png) [@damonkohler](https://discuss.gradle.org/u/damonkohler)\
**Post date:** [March 6, 2012, 9:16am UTC](https://discuss.gradle.org/t/maven-plugin-install-task-not-being-called/6994/6 "2012-03-06T09:16:00Z")

</div>

Thanks, that works great.

Is there a concise way to group the dependencies that should exclude rosjava\_bootstrap? I tried:

```gradle
dependencies {
  compile(["xxx:std_msgs:1.0", "xxx:rosgraph_msgs:1.0"]) {
    exclude module: "rosjava_bootstrap"
  }
}

```

---

<div class="post-metadata">

**Author:** ![Peter\_Niederwieser](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@Peter\_Niederwieser](https://discuss.gradle.org/u/Peter_Niederwieser)\
**Post date:** [March 6, 2012, 9:59am UTC](https://discuss.gradle.org/t/maven-plugin-install-task-not-being-called/6994/7 "2012-03-06T09:59:00Z")

</div>

A simple solution is to exclude ‘rosjava\_bootstrap’ globally with ‘configurations.compile.exclude module: “rosjava\_bootstrap”’ or ‘configurations.all\*.exclude module: “rosjava\_bootstrap”’.

---

<div class="post-metadata">

**Author:** ![damonkohler](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/damonkohler/32/679_2.png) [@damonkohler](https://discuss.gradle.org/u/damonkohler)\
**Post date:** [March 6, 2012, 11:48am UTC](https://discuss.gradle.org/t/maven-plugin-install-task-not-being-called/6994/8 "2012-03-06T11:48:00Z")

</div>

Wouldn’t that also exclude it where it’s necessary (i.e. in the rosjava project)? Or did you mean that I should do that on a per subproject basis?

Is this:

```gradle
exclude module: 'rosjava_bootstrap'

```

somehow different than this:

```gradle
exclude project(':rosjava_bootstrap')

```

In rosjava the dependency is:

```gradle
dependencies {
  compile project(':rosjava_bootstrap')
}

```
