This message was deleted.
# community-support
s
This message was deleted.
r
the build works locally and packages the jar correctly. could a reason be regarding different OS ? pipeline is on linux while local machine is on windows
Copy code
/build/classes/java/main', not found
build/resources/main', not found
this is what I get from logs on the jenkins machine. however my whole point was to package a module without main class. any ideas ?
c
Stuck? Or not including correct files? The . In the from is sketchy. Should use project.layout.projectDir if that's the intent.
even then, that will grab a bunch of stuff you may not intend - build directories, etc. If it’s a specific folder would suggest specifying that (or a set of folders).
r
Hi Chris ! Thanks a lot for answering. So yes, it does get stuck, locally it outputs same logs but packages everything. Also, my intention is to grab everything. I'll try using your suggestion
c
ok. are you really sure you want everything? There’s transient build stuff in
build
, gradle caches in
.gradle
, the gradle wrapper etc in
gradle
etc that are unlikely to be of interest, and may become quite large (depending on your project).
r
I was thinking that I may need everything since some classes have dependencies - but I guess that's just build.gradle. After applying your suggestion, my pipeline is still stuck on the jar task. What's really confusing to me is that, if I leave jar { enabled = true} pipeline finishes with no issue, however that won't grab anything except for the manifest. as soon as I replace the enabled line with from and include, pipeline hangs on the jar task, whereas local build create a jar with everything (96kb)
c
yea. it’s likely running out of memory. in any event, that isn’t the right way to solve the problem. You’re looking for a shaded jar (to include the dependencies). To do that: 1. Leave the jar task as-is to create the base jar (compiled Java files & resources);
2. Use the shadow plugin to add in the dependencies (and likely relocate their packages to avoid conflicts with consumers of your jar)
Would triple check that you really need a shadow jar - they’re usually a last resort due to side-effects etc.
r
my goal is to: 1) have a flyway helper class inside testFixtures (which has flyway dependency) 2) have an sql folder with migrations 3) package those things so that I can consume the helper with migrations . I've managed to do this successfully with the above jar config and publish to local maven repo. sadly now PR is failing on the pipe even though size of jar is quite small (or so I think). sorry if I drifted off topic, quite new to all these things
another issue is the jar-task as is creates an almost empty jar (probably because I have no main directory / class)
c
Typical project layout for that would be: • src/main/java - where your helper class lives; • src/main/resources - where your SQL migration files live …from that the regular
jar
task will bundle those up. Consumers of that jar will transitively pull in flyway.
1
r
hmm , I guess I've overthinked everything with testFixtures. Will try your layout !
c
testFixtures
is another source set which could also be used: • src/testFixtures/java • src/testFixtures/resources …that would be used when distributing test fixtures, for consumption/execution in tests in other projects.
1
r
@Chris Lee you were completely right about the memory. As soon as I've dropped some useless stuff build passes on pipeline. And thanks for all the suggestions. I owe you a beer !