# How to add custom properties to configurations

**URL:** <https://discuss.gradle.org/t/how-to-add-custom-properties-to-configurations/3687>\
**Category:** Old Forum Archive\
**Created:** [September 1, 2013, 10:39am UTC](https://discuss.gradle.org/t/how-to-add-custom-properties-to-configurations/3687 "2013-09-01T10:39:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris1](https://avatars.discourse-cdn.com/v4/letter/c/ac91a4/32.png) [@Chris1](https://discuss.gradle.org/u/Chris1)\
**Post date:** [September 1, 2013, 10:39am UTC](https://discuss.gradle.org/t/how-to-add-custom-properties-to-configurations/3687/1 "2013-09-01T10:39:00Z")

</div>

I’d like to use a custom syntax within closure argument to “configurations” in my dependency configuration file

```gradle
configurations {
    configA
    configB { userProperty 'user value' }
}

```

When executing gradle, I get error message “Could not find method userProperty() for arguments [user value] on configuration ‘:configB’.”

My plan is to implement a custom class Configuration, resp. replace or extend class DefaultConfiguration.

By browsing the source of gradle it seems to me, that I have to implement ConfigurationContainer, resp. replace or extend DefaultConfigurationContainer.

I wonder, whether this is the best way and whether it is wise to extend internal gradle classes.

- Is there an easier or recommended solution? - Could plugins help here? - Are there properties or methods of Project, that are better suited to achieve my task?

I’m currently bound to gradle 1.4, but the problem seems to be identical up to gradle 1.7.

Greetings, Chris.

---

<div class="post-metadata">

**Author:** ![Attila\_Kelemen](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/attila_kelemen/32/12083_2.png) [@Attila\_Kelemen](https://discuss.gradle.org/u/Attila_Kelemen)\
**Post date:** [September 1, 2013, 10:12pm UTC](https://discuss.gradle.org/t/how-to-add-custom-properties-to-configurations/3687/2 "2013-09-01T22:12:00Z")

</div>

Instead of writing ‘userProperty ‘user value’’ which is equivalent to a method call: ‘userProperty(‘user value’)’. You have to write ‘ext.userProperty = ‘user value’’. Actually, “ext” is usable in most context.

I would avoid implementing interfaces of the Gradle API because often new methods are added to existing interfaces in new versions of Gradle. Extending implementations are problematic as well because they are usually “internal”.
