Comments (9)
I have turned off the processJandexIndex
task and modified the jar
task. This works fine for my use case.
from vlsi-release-plugins.
Unfortunately, there's no clear way of adding generated index into resources
.
In Gradle, resource
files are inputs to compilation tasks.
jar index
takes compilation results and it creates the index.
If we add the index to resources
, then it creates a circular loop.
See gradle/gradle#12774 (comment)
So the workaround is to add the file into build/resources/main
directory.
Of course, it might invalidate processResources
as it will find an unexpected file in build/resources/main
.
On the other hand, it might be slightly better to avoid copying the index into build/resources/main
, and add them only into .jaronly (e.g. configure
jartask to include the index). The drawback will be that tests running with
build/main/classesin classpath would fail to find the index via
ClassLoader.getResource`.
WDYT?
from vlsi-release-plugins.
I had a similar idea, modifiy the jar task to include the index, but that does bring the drawback you mentioned. Modifying the processResources task doesn't work because it runs too early.
So maybe it is possible to make the "classes" task depend on the jandex tasks, and then tell the "processResources" task that it must run after the jandex task. Would that mess anything up?
from vlsi-release-plugins.
Would adding the "build/jandex/jandexMain" dir as a resource dir to the source set solve the testing issue?
from vlsi-release-plugins.
If processJandexIndex
removes other files from build/resources/...
, then I should probably use a different class for processJandexIndex
itself. E.g. make it a regular sync
task that copies only a single index file. Then it shouldn't remove other files.
The drawback would be it might trigger re-execution of processResources
, which, I guess, might be acceptable.
from vlsi-release-plugins.
Would adding the "build/jandex/jandexMain" dir as a resource dir to the source set solve the testing issue?
The issue is that Gradle assumes all resource directories are inputs for compileJava
tasks, so it would go wild when it starts compileJava
and sees no files in build/jandex/jandexMain
. On second execution, it will detect the previously built index, and it would trigger re-compilation.
from vlsi-release-plugins.
Are you sure about that? I don't think compileJava
does anything with the resources.
from vlsi-release-plugins.
I have not tried that.
from vlsi-release-plugins.
processResources
is not by default a requirement for the compileClasses
task see https://docs.gradle.org/current/userguide/java_plugin.html#sec:java_tasks
But there may actually be some folks who configured in in their builds to be this way, depends if you'd like to take the rist of a circular dependency for some projects or not.
I also have to contradict the statement that messing around with another tasks output may be acceptable. Newer gradle versions specifically enforce getting rid of such behavior up to the point the plugin won't work anymore. It also destroys the whole build avoidance gradle is so proud of.
Currently I think the best option is to customize the jar
task to include the index file, also declaring a dependency on the index task.
If you need the index in your tests add the output folder of the main
SourceSet to your test/resources
(and a dependency for the processTestResources
). Of course if you build a jar of your tests you'll have to make sure the index from the main is replaced with your test classes index...
from vlsi-release-plugins.
Related Issues (20)
- Add quotes for javap command in jandex plugin
- UnknownTaskException: Task with name 'check' not found HOT 1
- checksum-dependency-plugin cannot download pgp keys HOT 4
- XmlSlurper is too strict when reading POM files for license report HOT 1
- Problems when publishing calcite to the private maven nexus repo HOT 5
- Add license check HOT 9
- license-gather: Handling of multi-license dependencies HOT 2
- Sigstore: signing and verification
- [Discussion] Advice for using the license gather plugin in a multi-module project. HOT 3
- [license-gather-plugin] Ability to handle multiple licensed artefacts HOT 1
- [licence-gather-plugin] Upon failure to find license, indicate the dependency HOT 5
- Upgrade grgit HOT 2
- [stage-vote-release-plugin] Execution failed for task ':releaseRepository' due to missing nexus.txt file HOT 5
- [Gradle Extensions Plugin] Typed property delegates for required properties HOT 2
- After upgrade to gradle 8.x com.github.vlsi.jandex.JandexWork fails with CIRCULAR REFERENCE ArrayIndexOutOfBoundsException HOT 1
- [stage-vote-release-plugin] signingKey instead of secretKeyRingFile HOT 5
- Gradle 8.1.1: Querying the mapped value of flatmap(provider(task 'distTar', class org.gradle.api.tasks.bundling.Tar)) before task ':release:distTar' has completed is not supported HOT 1
- Dependency Dashboard
- Jandax fail when using java modularity (JPMS) HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vlsi-release-plugins.