Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to build jar: Cannot convert the provided notation to a File or URI: java.io.BufferedWriter@ #34

Open
claudiga opened this issue Mar 5, 2018 · 12 comments

Comments

@claudiga
Copy link

claudiga commented Mar 5, 2018

I am trying to build a jar, so i followed the instructions but every-time i run the task i get this error. I'm i missing something in the build.gradle file?

Execution failed for task ':awesomeFunJar'.

Cannot convert the provided notation to a File or URI: java.io.BufferedWriter@48e04250.
The following types/formats are supported:
- A String or CharSequence path, for example 'src/main/java' or '/usr/include'.
- A String or CharSequence URI, for example 'file:/usr/include'.
- A File instance.
- A Path instance.
- A Directory instance.
- A RegularFile instance.
- A URI or URL instance.


My build.gradle is:

apply plugin: 'gradle-one-jar'
apply plugin: 'java'


buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.github.rholder:gradle-one-jar:1.0.4'
    }
}


task awesomeFunJar(type: OneJar) {
    mainClass = 'com.practice.Application'
}

repositories {
  
        mavenCentral()
}

dependencies {
    
}
@haribachala
Copy link

I am also facing the same issue, with latest gradle 4.2.

@rherrmann7
Copy link

Ditto... I'm going to give shadow a try instead.... https://github.com/johnrengelman/shadow

@claudiga
Copy link
Author

I just use the java plugin it works pretty well

@mnlipp
Copy link

mnlipp commented Jun 29, 2018

Confirmed as issue for gradle 4.8.1.

@nros
Copy link

nros commented Jun 30, 2018

the missing stack trace is:

Caused by: org.gradle.internal.typeconversion.UnsupportedNotationException: Cannot convert the provided notation to a File or URI: java.io.BufferedWriter@7107255.
The following types/formats are supported:
  - A String or CharSequence path, for example 'src/main/java' or '/usr/include'.
  - A String or CharSequence URI, for example 'file:/usr/include'.
  - A File instance.
  - A Path instance.
  - A Directory instance.
  - A RegularFile instance.
  - A URI or URL instance.
        at org.gradle.internal.typeconversion.ErrorHandlingNotationParser.parseNotation(ErrorHandlingNotationParser.java:56)
        at org.gradle.api.internal.file.AbstractFileResolver.convertObjectToFile(AbstractFileResolver.java:117)
        at org.gradle.api.internal.file.AbstractBaseDirFileResolver.doResolve(AbstractBaseDirFileResolver.java:69)
        at org.gradle.api.internal.file.AbstractFileResolver.resolve(AbstractFileResolver.java:85)
        at org.gradle.api.internal.file.AbstractFileResolver.resolve(AbstractFileResolver.java:67)
        at org.gradle.api.java.archives.internal.DefaultManifest.writeTo(DefaultManifest.java:215)
        at org.gradle.api.java.archives.Manifest$writeTo.call(Unknown Source)
        at com.github.rholder.gradle.task.OneJar$_writeOneJarManifestFile_closure4.doCall(OneJar.groovy:187)
        at com.github.rholder.gradle.task.OneJar.writeOneJarManifestFile(OneJar.groovy:182)
        at com.github.rholder.gradle.task.OneJar$writeOneJarManifestFile.callCurrent(Unknown Source)
        at com.github.rholder.gradle.task.OneJar.buildOneJar(OneJar.groovy:164)
        at com.github.rholder.gradle.task.OneJar$_closure1.doCall(OneJar.groovy:113)
        at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:732)
        at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:705)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:124)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:317)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:309)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:185)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:97)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:113)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:95)
        ... 29 more

@nros
Copy link

nros commented Jun 30, 2018

this commit in a fork fixes this issue:
bryanxtong@ba3b7cb

already in pull request #32

@nros
Copy link

nros commented Jun 30, 2018

To include your own local copy of the fixed plugin into your gradle build, see here:
https://stackoverflow.com/questions/35302414/adding-local-plugin-to-a-gradle-project#answer-35472676

buildscript{
    repositories{
        ...
    }

    dependencies{
        classpath files('relative/path/to/plugin.jar')
    }
}

apply plugin: fully.qualified.package.PluginClassName

@pskowronek
Copy link

Any hope for new release including the provided pull request #32? It is like 3 months already and still no official release...

@danailKondov
Copy link

Same error, fix it already plz

@herbertpimentel
Copy link

theres any known workaround for this ?

@nsoft
Copy link

nsoft commented May 6, 2020

I've forked one-jar into https://github.com/nsoft/uno-jar and provided a gradle task. Let me know if something isn't working.

topherbuckley added a commit to topherbuckley/ioio that referenced this issue Aug 19, 2020
hannesa2 pushed a commit to ytai/ioio that referenced this issue Aug 22, 2020
hannesa2 pushed a commit to ytai/ioio that referenced this issue Aug 22, 2020
hannesa2 pushed a commit to ytai/ioio that referenced this issue Aug 22, 2020
@nreckle
Copy link

nreckle commented Feb 6, 2021

I have the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants