Switching your Gradle builds from JCenter to Maven Central

JCenter is being decommissioned on May 1st, 2021. Since many Gradle builds use JCenter by default, this means your Gradle build file is likely to have jcenter() in it. This means you have a few months to switch to Maven Central. Don’t worry, it’s easy.

Note: If you work for a company, you are hopefully using an internal binary repository proxy. (ex: Nexus, Artifactory, etc)

What’s the difference between JCenter and Maven Central?

The main benefits of JCenter are:

  • Some artifacts are in JCenter and not Maven Central – their authors are working on moving them to Maven Central. This is unlikely to affect FRC teams, but might affect people using an artifact that is more specialized.
  • It’s easier to publish to JCenter – Sonatype has been working on making it easier for Maven Central. Some of that is intrinsic though because Sonatype does a lot of verification.
  • JCenter is faster – Remember that artifacts are cached on your machine. So once you’ve downloaded the artifacts, your build performance is the same.

How do I find the affected files in GitHub?

Searching on github for either of these does not do what you might expect

  • jcenter user:boyarsky filename:build.gradle- the code tab returns 0 results
  • jcenter org:stuypulse filename:build.gradle – the code tab returns 2 results

That’s because github search only looks in files that have been updated or returned in search results in the past year. Unfortunately, the last year has not been particularly representative of a normal year. And people edit/search the contents of build.gradle files way less frequently than other file types.

I recommend just searching for the filename. That returns all your build.gradle files so you can edit them. (And since you are probably consistent in your choice of binary repository, you can sample a few matches to see if you have to change.

  • user:boyarsky filename:build.gradle – the code tab returns 5 results
  • org:stuypulse filename:build.gradle – the code tab returns 24 results

Tip: You may also have a reference to jcenter in your settings.gradle so I recommend searching that as well.

How do I edit the file?

GitHub has good Rest APIs so you can script this if you have a lot. If you don’t have a ton, either of the following is viable. (I had 5 build.gradle files in my personal repo and 3 of them were already using Maven)

Option 1 – Use the browser

  1. Open each link from the code tab of the search
  2. Choose the default branch (ex: main/master) from the pull down – search often returns a specific commit
  3. Drill down to the build.gradle file if not already there.
  4. Click the edit/pencil icon in the top right (just above the code)
  5. Change jcenter() to mavenCentral()
  6. Enter a commit comment and save
  7. If you want to make sure your build still works, run it (ex: Travis)

Option 2 – Clone the repos

(Tested on Mac; I don’t have Git Bash on my home computer so don’t know if it works exactly the same. I have used find on Git Bash though so I think it does)

  1. Clone the affected repos (if you don’t already have them)
  2. Go to a parent directory of the github repos (ex: <userHome>/git
  3. Run a UNIX command to update the list files find . -name build.gradle
  4. Run a UNIX command to update the affected files: find . -name build.gradle -exec sed -i ” -e ‘s/jcenter/mavenCentral/g’ {} \;
  5. Commit/push the affected repos (listed in step 3)
  6. If you want to make sure your build still works, run it (ex: ./gradlew build)

streamyard, virtual backgrounds, and room dividers

I live in a studio apartment. That means quite a bit of stuff is visible from my computer camera. As you might imagine, I’m a bit fan of virtual backgrounds. For work, it is easier. It’s not a problem if my co-workers see my work stuff, I don’t care if they see my mess and seeing a place that isn’t ideal for work just shares the message that I’m not enjoying my working from home full time here.

For non-work, it’s even harder. I have a nice spot for my personal machine/desk. I didn’t have a good spot for my work machine/documents. I wound up using the “empty” path that is right behind my personal computer. (Empty is in quotes because I used to do physical projects, store things there, dump them as I walked in, etc)

This means that the camera on my personal machine has a great view of all my work stuff. For JChampions Conf, I’m moderating a few sessions. Streamyard doesn’t have virtual backgrounds (unless you have an actual green or blue screen.) I don’t know how much I’ll be on camera if at all. But I won’t know until the day of. This leaves me with some inconvenient choices.

  1. Put away my work stuff. That’s problematic as some of the sessions I’m moderating are adjacent too or in between work hours.
  2. Move my personal laptop elsewhere. That’s awkward because I have two monitors, a proper keyboard, etc at my personal desk. Moving to the couch or my bed is not going to be comfortable.
  3. Turn off my video and be audio only. The default image is a blank circle. That looks terrible. (I don’t know how to upload a photo instead. And it’s a shared account so I wouldn’t even if i could.)
  4. Use a physical barrier. I own a room divider so I dragged it behind me. It’s annoying to set it up and leaves a crack of orange (the wall). But it does hide the stuff. I actually thought about using it to block off my work area so I wouldn’t see it constantly. But it comes with a limitation. I have a width of 14 inches to get to my personal computer and a width of 13 inches to get to my work machine when it is setup. Which means I’m not leaving it up and will need to set it up each of the four days. (The width of a human shoulder to shoulder is typically larger than 13-14 inches so I have to turn sideways to move around my apartment when this is setup.

re the interview question “what did you do with your extra time during the pandemic”

I turned on the television and heard a sentence about expecting a question during an interview – “what did you do with your extra time during the pandemic”. I don’t know the context or if this is a common question. I certainly hope is isn’t!

Is this an illegal question?

I’m not a lawyer, so I don’t know. It feels dangerously close to illegal questions though. You aren’t allowed to ask someone at an interview if they have kids. And guess what group of people did not have extra time during the pandemic? People with young children.

Similarly, you aren’t allowed to ask if someone had COVID-19. Guess what other group of people did not have extra time during the pandemic? People with long haul COVID-19.

Is this an insensitive question?

Absolutely. Some people had less time during the pandemic. Some were upset. Some found it hard to concentrate. Some lost an immediate family member. Also, it’s none of your damn business.

Why are you asking in the first place?

I’ll assume you aren’t being nosy or trying to cleverly find out information that would be illegal to ask. And how does it help you find out that your prospective hire is now an expert in making sourdough bread. The only answer I can think of that is relevant to the job is what skills the person has learned that are RELEVANT to the job. In which case…

What could you ask instead to accomplish the same result?

“What is the last thing you learned about technology?” – this is an appropriate question to ask. I’ve asked it before the pandemic. This question doesn’t have assumptions in it about how recently you learned something. It doesn’t suggest something is wrong with you if you haven’t had time or energy during a pandemic to learn something new, you can still list something you learned in 2019.

What would be my answer

It’s hard to answer this hypothetically because it depends on how much one needs the job. Let’s assume I do and decided to answer the question in some form.

Side note: When I was interviewing for entry level jobs, I was asked “how would you handle being treated differently because you are female.” My answer was “why? is that a problem here?” (with some attitude in my tone.) I still got an offer. I declined.

“I finished writing the OCP 11 Practice Tests book with Scott, read some technical books, passed the AWS associate architect exam and served on the planning committee for the first ever JChampions conference.”

What is my honest answer

While my answer is factually true, none of that was what I did with my extra time for several reasons.

  • I would have done those things anyway.
  • I read less books in 2020 than in any of the past years I can remember. (I read tech books during my commute.) Trying to read at home, I get distracted. Most of the tech books I managed to read were when it was warm enough to sit outside.
  • I was unable to do my annual CodeRanch “JForum Day” feature for the first time in 11 years. I really wanted to do this. But I spent the finite amount of energy I had in the winter for coding/thinking on work. It wasn’t available for my extra time. So I objectively did and learned less in 2020 than in a normal year.
  • Studying for and taking the AWS exam was a mistake. I wasn’t able to retain information even in the short term. I cried numerous times trying to force myself to do so. I’ve already forgotten what I ‘learned’ and will have to re-learn it when things are better. I wish I had noticed what was going on earlier and stopped trying.
  • I spent most of my “extra time” trying to be physically and mentally ok.
  • All but one of the people I know who is comfortable physically getting together are two train rides (and over 90 minutes) away. This means it takes pretty much a whole weekend day to have any human interaction.
  • Having video/virtual contact is more tiring than real human contact. So the energy I put into trying to keep myself ok came out of my ability to do other things.

And none of this is bad. I believe expecting people to have learned and accomplished more during a pandemic is inconsiderate. Unless you believe we are going to be under stay at home orders for another year and learning during it is a requirement for your job, ask a different question!