Gradle Jar Task Type: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 5: Line 5:
=Internal=
=Internal=
* [[Gradle_Task#Java_Plugin_Predefined_Task_Types|Gradle Tasks]]
* [[Gradle_Task#Java_Plugin_Predefined_Task_Types|Gradle Tasks]]
* [[Gradle Java Plugin|Java Plugin]]
* [[Gradle_Java_Plugin#Java_Plugin_Predefined_Task_Types|Java Plugin]]
 
=Overview=
=Overview=


Line 12: Line 13:
=Configuration=
=Configuration=
==Properties==
==Properties==
===<tt>archiveBaseName</tt>===
====Input Properties====
===<tt>from</tt>===
====<tt>archiveBaseName</tt>====
====<tt>from</tt>====
Specifies source files or directories to include in the archive. The given paths are evaluated as per [[Gradle_File_Resolution#Project.files.28Object..._paths.29|Project.files(Object ...)]].
Specifies source files or directories to include in the archive. The given paths are evaluated as per [[Gradle_File_Resolution#Project.files.28Object..._paths.29|Project.files(Object ...)]].
===<tt>exclude</tt>===
 
===<tt>manifest</tt>===
The values passed to "from" become [[Gradle_Incremental_Builds#Inputs|inputs]] for the task and they are used for [[Gradle_Incremental_Builds#up-to-date-check|up-to-date]] checks.
====<tt>attributes</tt>====
 
====<tt>exclude</tt>====
====<tt>manifest</tt>====
=====<tt>attributes</tt>=====
Example:
Example:
<syntaxhighlight lang='groovy'>
<syntaxhighlight lang='groovy'>
Line 25: Line 30:
}
}
</syntaxhighlight>
</syntaxhighlight>
===<tt>duplicatesStrategy</tt>===
====<tt>duplicatesStrategy</tt>====
===<tt>zip64</tt>===
====<tt>zip64</tt>====
===Output Properties===
====<tt>archiveFile</tt>====
{{External|https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.Jar.html#org.gradle.api.tasks.bundling.Jar:archiveFile}}
 
==Methods==
==Methods==
===<tt>with</tt>===
===<tt>with</tt>===

Latest revision as of 00:15, 15 December 2020

External

Internal

Overview

Exposed by the java plugin as jar task.

Configuration

Properties

Input Properties

archiveBaseName

from

Specifies source files or directories to include in the archive. The given paths are evaluated as per Project.files(Object ...).

The values passed to "from" become inputs for the task and they are used for up-to-date checks.

exclude

manifest

attributes

Example:

task myJar(type: Jar) {
  ...
  manifest.attributes 'Main-Class': "playground.Main"
}

duplicatesStrategy

zip64

Output Properties

archiveFile

https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.Jar.html#org.gradle.api.tasks.bundling.Jar:archiveFile

Methods

with

https://docs.gradle.org/current/dsl/org.gradle.jvm.tasks.Jar.html#org.gradle.jvm.tasks.Jar:with(org.gradle.api.file.CopySpec[])

Adds the given CopySpec as a child of the current CoypSpec.

Example:

task fatJar(type: Jar, dependsOn: jar) {
  ...
  with jar
}