# addArtifact() removed - what do I use instead?

**URL:** <https://discuss.gradle.org/t/addartifact-removed-what-do-i-use-instead/5369>\
**Category:** Old Forum Archive\
**Created:** [April 16, 2012, 4:25pm UTC](https://discuss.gradle.org/t/addartifact-removed-what-do-i-use-instead/5369 "2012-04-16T16:25:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ben\_Halton](https://avatars.discourse-cdn.com/v4/letter/b/b5a626/32.png) [@Ben\_Halton](https://discuss.gradle.org/u/Ben_Halton)\
**Post date:** [April 16, 2012, 4:25pm UTC](https://discuss.gradle.org/t/addartifact-removed-what-do-i-use-instead/5369/1 "2012-04-16T16:25:00Z")

</div>

So addArtifact() was removed in milestone 9, and one of the plugins I use (oneJar) has some code like this:

```gradle
project.configurations.archives.addArtifact(
[
getClassifier: { -> "standalone" },
getDate: {-> date },
getExtension: {-> "jar" },
getType: {-> "jar" },
getFile: {-> jarFile },
getName: {-> name }
] as PublishArtifact
)

```

So now the oneJar plugin doesn’t work with the lastest version of Gradle, what can I replace the code above with?

Cheers, Ben

---

<div class="post-metadata">

**Author:** ![Carl\_Quinn](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/carl_quinn/32/1202_2.png) [@Carl\_Quinn](https://discuss.gradle.org/u/Carl_Quinn)\
**Post date:** [April 16, 2012, 7:38pm UTC](https://discuss.gradle.org/t/addartifact-removed-what-do-i-use-instead/5369/2 "2012-04-16T19:38:00Z")

</div>

I submitted a pull request to Robert Fischer for a fix that I had made to this problem in the oneJar plugin:

- 

project.configurations.archives.addArtifact(

- 

project.artifacts.add(‘archives’,

But I have not heard from him.

---

<div class="post-metadata">

**Author:** ![luke\_daley](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/luke_daley/32/9890_2.png) [@luke\_daley](https://discuss.gradle.org/u/luke_daley)\
**Post date:** [April 18, 2012, 11:43am UTC](https://discuss.gradle.org/t/addartifact-removed-what-do-i-use-instead/5369/3 "2012-04-18T11:43:00Z")

</div>

Carl is right, the replacement is ‘artifacts.add’.

---

<div class="post-metadata">

**Author:** ![Ben\_Halton](https://avatars.discourse-cdn.com/v4/letter/b/b5a626/32.png) [@Ben\_Halton](https://discuss.gradle.org/u/Ben_Halton)\
**Post date:** [April 19, 2012, 8:31am UTC](https://discuss.gradle.org/t/addartifact-removed-what-do-i-use-instead/5369/4 "2012-04-19T08:31:00Z")

</div>

Thanks guys that’s really helpful
