GithubHelp home page GithubHelp logo

Comments (3)

javabrett avatar javabrett commented on August 11, 2024

I think this is to do with how the in-place appRun assembles the classpath and resource-path. For example, ./gradlew clean :web:appRunWar works fine.

Also, if you run a build then cp lib/src/main/resources/hello.properties lib/build/classes/java/main/, then :web:appRun will also work.

I've seen this before in my projects and lamented that appRun can't really assemble the war-like behaviour completely.

I'm curious about java-library fixing it though - can you push another branch to your example project to demonstrate?

from gretty.

carey avatar carey commented on August 11, 2024

Here's the change on new branch: https://github.com/carey/gretty-resources/compare/java.

As I understand it, the java-library plugin was made so that Java compilation would be much faster. It doesn't need to build against a jar for this, just build/classes. But apparently it doesn't need the resources, either.

from gretty.

javabrett avatar javabrett commented on August 11, 2024

Thanks. For clarity, after execution of :web:appRun using the java plugin instead of java-library, the following additional files are present:

diff java-library.txt java.txt 
16a17,21
> lib/build/resources
> lib/build/resources/main
> lib/build/resources/main/hello.properties
> lib/build/libs
> lib/build/libs/lib.jar
17a23,24
> lib/build/tmp/jar
> lib/build/tmp/jar/MANIFEST.MF

So java is both building the jar and copying the resources file into the build tree. As already observed, running :lib:jar results in the same files as above, and everything works fine.

I think this was partially anticipated by the Gradle team according to https://docs.gradle.org/current/userguide/java_library_plugin.html#sec:java_library_known_issues_compat . So I think what we could do here is try and link in with java-library and effectively force the dependency on :lib:jar so that you don't have to run it explicitly. How does that sound?

I'm not sure there are other good options based on what the standard lifecycle of java-library is doing (or not doing) with resources, but someone else might have a suggestion.

Of course pull-requests for this are welcome :).

from gretty.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.