# Controlling eclipse project name with archivesBaseName not working when configured from root multiproject build file

**URL:** <https://discuss.gradle.org/t/controlling-eclipse-project-name-with-archivesbasename-not-working-when-configured-from-root-multiproject-build-file/5396>\
**Category:** Old Forum Archive\
**Created:** [June 18, 2012, 10:04pm UTC](https://discuss.gradle.org/t/controlling-eclipse-project-name-with-archivesbasename-not-working-when-configured-from-root-multiproject-build-file/5396 "2012-06-18T22:04:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kirk\_Rasmussen](https://avatars.discourse-cdn.com/v4/letter/k/96bed5/32.png) [@Kirk\_Rasmussen](https://discuss.gradle.org/u/Kirk_Rasmussen)\
**Post date:** [June 18, 2012, 10:04pm UTC](https://discuss.gradle.org/t/controlling-eclipse-project-name-with-archivesbasename-not-working-when-configured-from-root-multiproject-build-file/5396/1 "2012-06-18T22:04:00Z")

</div>

I’m attempting to keep my gradle build as DRY as possible so in my root build.gradle I have:

```gradle
def groovyProjects() {
    subprojects.findAll() { project ->
        def dir = project.file('/src/main/groovy')
        def exists = dir.isDirectory()
        return exists
    }
}
  configure(groovyProjects()) { project ->
 apply plugin: 'groovy'
 apply plugin: 'eclipse'
 apply plugin: 'idea'
    archivesBaseName = "$group.$project.name"
   }

```

and in api/build.gradle I have

```gradle
eclipse {
 project {
  name = archivesBaseName
 }
}

```

which works great. My JAR file and Eclipse project name are kept in sync this way. However to make it even DRYer I tried to move the eclipse stanza into the root build.gradle file so I wouldn’t have to repeat it over and over

```gradle
configure(groovyProjects()) { project ->
 apply plugin: 'groovy'
 apply plugin: 'eclipse'
 apply plugin: 'idea'
           archivesBaseName = "$group.$project.name"
          eclipse {
           project {
                name = archivesBaseName
            }
        }
 }

```

but that resulted in error:

```gradle
FAILURE: Build failed with an exception.
  * Where:
Build file 'X:\workspaces\test\build.gradle' line: 36
  * What went wrong:
A problem occurred evaluating root project 'test'.
> Could not find method call() for arguments [build_2dvjv1juj01i4g3c2o8l9tasns$_run_closure2_closure8_closure11@2d581156
] on project ':api'.
  * Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
  BUILD FAILED

```

Any ideas? I am using Gradle 1.0.

BTW Great job guys on an important milestone!

---

<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:** [June 18, 2012, 10:51pm UTC](https://discuss.gradle.org/t/controlling-eclipse-project-name-with-archivesbasename-not-working-when-configured-from-root-multiproject-build-file/5396/2 "2012-06-18T22:51:00Z")

</div>

I guess the ‘project’ -\> closure parameter collides with ‘eclipse { project { … } }’. Remove the former.

The Groovy project detection code could be shortened to something like ‘def groovyProjects = subProjects.findAll { file(“src/main/groovy”).directory }’.

---

<div class="post-metadata">

**Author:** ![Kirk\_Rasmussen](https://avatars.discourse-cdn.com/v4/letter/k/96bed5/32.png) [@Kirk\_Rasmussen](https://discuss.gradle.org/u/Kirk_Rasmussen)\
**Post date:** [June 20, 2012, 5:58pm UTC](https://discuss.gradle.org/t/controlling-eclipse-project-name-with-archivesbasename-not-working-when-configured-from-root-multiproject-build-file/5396/3 "2012-06-20T17:58:00Z")

</div>

Cool thanks I’ll give that a whirl.

---

<div class="post-metadata">

**Author:** ![Kirk\_Rasmussen](https://avatars.discourse-cdn.com/v4/letter/k/96bed5/32.png) [@Kirk\_Rasmussen](https://discuss.gradle.org/u/Kirk_Rasmussen)\
**Post date:** [June 20, 2012, 6:12pm UTC](https://discuss.gradle.org/t/controlling-eclipse-project-name-with-archivesbasename-not-working-when-configured-from-root-multiproject-build-file/5396/4 "2012-06-20T18:12:00Z")

</div>

It works. Thanks I didn’t even notice the naming collision. Duh!
