# Configure distribution artifacts

**URL:** <https://discuss.gradle.org/t/configure-distribution-artifacts/19368>\
**Category:** Help/Discuss\
**Created:** [September 5, 2016, 11:50am UTC](https://discuss.gradle.org/t/configure-distribution-artifacts/19368 "2016-09-05T11:50:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jux123](https://avatars.discourse-cdn.com/v4/letter/j/e79b87/32.png) [@jux123](https://discuss.gradle.org/u/jux123)\
**Post date:** [September 5, 2016, 11:50am UTC](https://discuss.gradle.org/t/configure-distribution-artifacts/19368/1 "2016-09-05T11:50:53Z")

</div>

Just started using Gradle first time and I am finding it difficult find information in the User Guide. Perhaps somebody can help me here.

So in my project, I am using Application plugin which itself uses Distribution plugin (firstly, already this is so confusing - how to find out what plugin is using what). So the application plugin is building me Jar along with Zip and Tar. The last two I do not need. How to configure, that my distribution artifacts is only the Jar file?

---

<div class="post-metadata">

**Author:** ![carlo\_lf](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/carlo_lf/32/1881_2.png) [@carlo\_lf](https://discuss.gradle.org/u/carlo_lf)\
**Post date:** [September 5, 2016, 7:51pm UTC](https://discuss.gradle.org/t/configure-distribution-artifacts/19368/2 "2016-09-05T19:51:07Z")

</div>

Read Chapter 30 on publishing Artifacts.

What you want can be as simple as this:

task myJar(type: Jar)

artifacts {  
archives myJar  
}

---

<div class="post-metadata">

**Author:** ![jux123](https://avatars.discourse-cdn.com/v4/letter/j/e79b87/32.png) [@jux123](https://discuss.gradle.org/u/jux123)\
**Post date:** [September 6, 2016, 11:41am UTC](https://discuss.gradle.org/t/configure-distribution-artifacts/19368/3 "2016-09-06T11:41:49Z")

</div>

This did not make any sense to me.

What I have so far, is I use shadowJar plugin (com.github.jengelman.gradle.plugins:shadow:1.2.3) in my project. And in Jenkins I have gradle plugin + artifactory plugin, which handles the deployment of artifacts to Artifactory.

The shadowJar will be able to create fat Jar, which I need to deploy as well. So to enable it, I have configured:  
artifacts {  
archives shadowJar  
}

But this configuration does not remove zip and tar distribution in my build life cycle.

---

<div class="post-metadata">

**Author:** ![jvff](https://avatars.discourse-cdn.com/v4/letter/j/8491ac/32.png) [@jvff](https://discuss.gradle.org/u/jvff)\
**Post date:** [September 6, 2016, 12:36pm UTC](https://discuss.gradle.org/t/configure-distribution-artifacts/19368/4 "2016-09-06T12:36:18Z")

</div>

If you don’t want the archives to be created in your build lifecycle, I think the easiest solution would be to disable the tasks that create them:

```
distTar.enabled = false
distZip.enabled = false

```

That said, are you sure you need the application plugin? The purpose of the plugin (AFAICT) is to:

- configure the Jar to be executable (by setting the main class)
- generate platform specific distributions (ie. the zip and tar archives) for the Java application
- add an `install` and a `run` task to the build to help installing and running the resulting application in your local machine using Gradle

If you’re only distributing (or deploying) the fat Jar, I think there might be no need for the application plugin. You can just configure the Jar to be executable manually:

```
shadowJar {
    attributes 'Main-Class': 'my.main.Class'
}

```

If you need to, you can also configure a `run` task manually using the [`JavaExec`](https://docs.gradle.org/current/dsl/org.gradle.api.tasks.JavaExec.html) task type.

---

<div class="post-metadata">

**Author:** ![jux123](https://avatars.discourse-cdn.com/v4/letter/j/e79b87/32.png) [@jux123](https://discuss.gradle.org/u/jux123)\
**Post date:** [September 6, 2016, 1:46pm UTC](https://discuss.gradle.org/t/configure-distribution-artifacts/19368/5 "2016-09-06T13:46:05Z")

</div>

Thanks!  
distTar.enabled = false is what I tested before but installing the archives to local repo failed becuse it started to look for the tar file.

I could not configure shadowJar main class with that way. I use it together with the Application plugin for this purpose. I only used it because so was instructed on shadowJar doc.

I will try the JavaExec configuration.

EDIT: JavaExec is aparently not what I’m looking for. And seems like there is no other way to define main class in shadowJar ☹

EDIT: got it working!  
jar{  
manifest {  
attributes ‘Main-Class’: ‘com.kambi.emct.Application’  
}  
}
