Unable to add a File to artifacts in M5 as per user guide, error: "Notation is invalid for an artifact"


(Matias Bjarland) #1

Under gradle M5 I have the following single project build file:

apply plugin: 'java'
  def someFile = file('build/somefile.txt')
  artifacts {
    archives someFile
}

(sample project zip can be downloaded here)

the somefile and artifacts lines have been copied verbatim from the file artifacts section of the user guide where the guide states that you should be able to add a File to the artifact handler. The DSL guide indicates the same.

Executing a “gradle tasks” on the build file above gives the following result:

mbjarland$ gradle tasks
  FAILURE: Build failed with an exception.
  * Where:
Build file '/Users/mbjarland/tmp/gradle-m5-artifact-notation/build.gradle' line: 6
  * What went wrong:
A problem occurred evaluating root project 'gradle-m5-artifact-notation'.
Cause: Notation is invalid for an artifact! Passed notation=/Users/mbjarland/tmp/gradle-m5-artifact-notation/build/somefile.txt
  * Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
  BUILD FAILED
  Total time: 2.953 secs

Full debug log can be found here.

What I am trying to accomplish here is to (in addition to my existing jar artifact for this project) add an arbitrary disk file as a published artifact of the project.


(Peter Niederwieser) #2

File artifacts were introduced in m6. If you are using m5, please refer to the corresponding user guide (which doesn’t make such promises). The documentation for a particular Gradle version can easily be accessed from the main documentation page.


(Matias Bjarland) #3

Doh! My bad, should have caught that one. Thanks for the pointer.