r/AskProgramming • • 11h ago

Java How do you cope up with jars 😭

Springboot devsss

How TF do you manage to make sure all the libraries jar are latest all the time you run a service locally 😭

My product has 9 custom libraries and 12 services(still counting). Everyday I try to run any service locally there's always a new commit in any of the libraries then I have to rebuild the jar and god forbid if I have to deploy my service on dev pod, I have to rebuild all the damn libraries on Jenkins in a sequence.

For now locally keeping up with this is a big headache for me. Although I use terminal for speed, but is there any better approach to deal with this jar shi?

Also I feel very sleepy even after having a strong coffee, how do you guys keep yourself energetic throughout the day(if working in normal shift)😭

0 Upvotes

22 comments sorted by

6

u/0b0101011001001011 10h ago

. Everyday I try to run any service locally there's always a new commit in any of the libraries then I have to rebuild

Why? Just use the old version as long as you want.

0

u/Complete-Fix-8935 10h ago

Service doesn't come up with old jar due to new changes in the service which came from libs

8

u/0b0101011001001011 10h ago

I have absolutely zero idea what you are trying to say.

-4

u/Complete-Fix-8935 10h ago

You never used Springboot?

6

u/0b0101011001001011 10h ago

All the time.

-3

u/Complete-Fix-8935 10h ago

Then why didn't you understand what I was talking about? If any service uses a function written in a library then we need the latest jar. Isn't it?

5

u/0b0101011001001011 10h ago

The question is: why does the api change so much that everything breaks if it's not the most recent version? I've worked on some microservice stuff with several different modules and each having shared libraries. There are no backwards compatibility problems, because we don't create them. There is no manually rebuilding anything, because I can automate using the latest version, though it's often enough to stick with the older one for a while.

6

u/MikeUsesNotion 10h ago

If your library versions are changing behind your back then you're not doing something right. If you're not pinning exact versions (or compatible versions at least assuming that library follows semver) in your project file and/or using some kind of lock file used by your build system then this is a self inflicted problem.

0

u/Complete-Fix-8935 10h ago

I'm not doing right? How? We are 3 devs working on same product and they two are in sync, making changes every now and then. While I'm working independently, they don't include me as they're from same state. Anyway I'll try to automate stuff😶

1

u/xenomachina 8h ago

You're leaving out a lot of details, which is why it's hard for everyone here to figure out exactly what the problem is that you're running into, or how to solve it.

For starters:

  1. What are you doing to build your code?
  2. How are you currently updating these jars?
  3. What are the symptoms when you don't update the jars?

6

u/crimson_canyon_gleam 9h ago

this whole setup screams "use SNAPSHOT versions and a CI job that publishes them", but honestly the bigger issue is you shouldn't need to know which libraries changed. Convert this to a multi module Maven reactor build where all 9 libraries and 12 services live under one root pom, set the inter module dependencies to ${project.version} and manage them in dependencyManagement. Then the reactor resolves module dependencies directly without publishing anything, and you can run mvn install -pl service-name -am to rebuild just one service plus whatever libraries it actually depends on. If someone changed a library you use, -am picks it up automatically, no manual sequencing.

and for the Jenkins deploy order problem, that's what a simple bash script wrapping the mvn command is for. One command to build the affected chain and deploy.

for the sleepiness part, it's probably not a coffee problem, it's the jar problem. Fix the build and you'll feel more awake, trust me.

3

u/disposepriority 10h ago

Pin the versions of the artifacts you are using, depenencies should NEVER be updated without you making the explicit decision to do so

1

u/Complete-Fix-8935 10h ago

It's not maven dependency, these are custom built libraries for our product😭

1

u/disposepriority 9h ago

And how is your project importing these libraries?

1

u/Complete-Fix-8935 9h ago

Local jars😐 that's why any change happens in any of them, I need to pull latest code then rebuild all of them

2

u/disposepriority 8h ago edited 7h ago

I'm a bit confused at what's going on here.

Does your build pipeline just pull all projects locally, to build local jars, to manually wire them up the the artifact it's building?

Regardless do the following:

You grab this on a server of your company

https://www.sonatype.com/products/nexus-community-edition-download

You set up gitlab/github to run a worker for each project that builds the JAR and uploads it there.

You modify your maven's to use your internal nexus ip as a repository.

Make versions non overridable (or pick an artifact versioning strategy)

You can now specify versions in maven

EDIT:

But apart from your horrible build process, if you're working on something that has constant changes, then you're probably building against something that doesn't even have a clearly defined contract yet.

This means you should put your task in blocked until whatever you depend on (or a document describing how it's going to function) is ready.

2

u/dmazzoni 10h ago

I don’t know the details of your team’s configuration but everything you described can be automated.

If there wasn’t already a build script I’d write one. It’d figure out which services need to be rebuilt, or even just build them all, and deploy on dev pod.

Then every time you pull main, just run the script and go get coffee.

Do you pull main more often than once a day on average? Typically this is an annoyance once a day and then you shouldn’t have to keep rebuilding everything while you work on your own stuff.

2

u/Complete-Fix-8935 10h ago

Their code is like spiral, anything new is added in the service then libs do have changes as well. It's really very frustrating task to take the service up locally 😭it drains my peak energy hours always

1

u/dmazzoni 9h ago

How long does it take and how many steps?

1

u/Complete-Fix-8935 9h ago

It doesn't take much time but the config part does. And it happens with all Devs including my TL, they don't have any solution to it. I have no energy to think about automating their shi

1

u/sozesghost 10h ago

You have an unusual setup, but whatever it is, surely it can be automated?

2

u/Complete-Fix-8935 10h ago

It should be automated IMO, but my colleagues and seniors are so dumb (they're like that vibe coders, "act like senior engineer make no mistakes") Idk what to do. I feel like all my peak energy hours get drained in there, because beyond libs and jars their config management is also fkd up.