Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split the shaded jar out of application #6267

Merged
merged 4 commits into from
Dec 4, 2024

Conversation

t2gran
Copy link
Member

@t2gran t2gran commented Nov 21, 2024

Summary

Creating the otp-2.7.0-SNAPSHOT-shaded.jar takes a bit of time (12.5s) on my machine. Most developers never uses this, at least during regular development. So, I think this should go into a separate maven module and I will enable developers to skip it using -DskipShadeJar.

Issue

No issue exist.

Unit tests

🟥 This is changing the build configuration only.

Documentation

✅ I added some comments to the Maven pom.xml files to explain "non standard" config.

Changelog

🟥 Skip

Bumping the serialization version id

🟥 Not needed.

@t2gran t2gran added this to the 2.7 (next release) milestone Nov 21, 2024
@t2gran t2gran requested a review from a team as a code owner November 21, 2024 18:24
@t2gran t2gran marked this pull request as draft November 21, 2024 18:24
@leonardehrenfried
Copy link
Member

I build a shaded jar several times per day but I can easily update my scripts.

@t2gran
Copy link
Member Author

t2gran commented Nov 26, 2024

What do you use it for - development or deployment? I think we should aim to make the developer experience as fast/good as possible and then automate deployment/CI.

@leonardehrenfried
Copy link
Member

I use it for local development as that's how I build my instances. All configuration is in this repo and everything is scripted: https://github.com/leonardehrenfried/otp2-setup/

For deployments I use the container images: https://hub.docker.com/r/opentripplanner/opentripplanner/tags?page=1&page_size=&name=&ordering=

@leonardehrenfried
Copy link
Member

This is the command line that builds the jar and copies it: https://github.com/leonardehrenfried/otp2-setup/blob/main/Makefile#L410-L411

@t2gran
Copy link
Member Author

t2gran commented Nov 26, 2024

So, this is not a problem for you, you change one line are good. I never use the one-jar to run OTP locally, most of the time I use the InteractiveOtpMain.

For me the important ting is to run all unit test more or less continuously - as fast as possible.

I can also add a profile to turn OFF the shaded-jar.

@leonardehrenfried
Copy link
Member

Yes, I just have to change one line.

I'm curious though: mvn test doesn't build the shaded jar for me. What command are you running your tests with?

@t2gran
Copy link
Member Author

t2gran commented Nov 26, 2024

Any ideas why the build fails. I have seen this error on my local machine when the local Maven repo was configured wrong. But, I do not thisnk it is the same problem. When test is run, I thought Maven would set up the classpath with each module target\classes - not use the local repo. When you run with mvn install it should use the local repo.

There is an error in the raptor/pom.xml, my mistake.

@t2gran
Copy link
Member Author

t2gran commented Nov 26, 2024

Another question - Should we prefix each maven module with otp, e.g otp-utils, otp-raptor, otp-application.

  • If we do, all java modules will be listed together in the parent directory
  • The minus is that we repeat the context.
  • Our modules could now be used in other projects, so prefixing give the module unique names. This is not important since we do not support it - but we might use this in the future.

@t2gran t2gran marked this pull request as ready for review November 26, 2024 14:08
Copy link

codecov bot commented Nov 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.76%. Comparing base (5b5d92f) to head (51faf2c).
Report is 94 commits behind head on dev-2.x.

Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #6267      +/-   ##
=============================================
+ Coverage      69.71%   69.76%   +0.04%     
- Complexity     17696    17749      +53     
=============================================
  Files           2008     2010       +2     
  Lines          75834    75948     +114     
  Branches        7765     7784      +19     
=============================================
+ Hits           52866    52983     +117     
- Misses         20256    20257       +1     
+ Partials        2712     2708       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@t2gran
Copy link
Member Author

t2gran commented Nov 26, 2024

I'm curious though: mvn test doesn't build the shaded jar for me. What command are you running your tests with?

To only build raptor or application, when working on one module, you will need to run install- so you fetch the local dependencies from the localRepo, not the aggregate build.

The shaded-jar should be bound to the package phase, I see that I put it in the install - I will fix that. I will just add something witch make it easy to exclude it - the default will build it.

@t2gran t2gran merged commit 00ce56e into opentripplanner:dev-2.x Dec 4, 2024
5 checks passed
@t2gran t2gran deleted the build-one-jar-in-sep-module branch December 4, 2024 00:33
@leonardehrenfried
Copy link
Member

After merging this the speed tests started failing: https://github.com/opentripplanner/OpenTripPlanner/actions/runs/12150654267/job/33883827698

@VillePihlava
Copy link
Contributor

When I run mvn clean package no shaded jar is created inside application/target. Was this the intended result? Based on a quick read of this PR, I believe this should only happen with the -DskipShadeJar option.

@leonardehrenfried
Copy link
Member

The shaded jar is now located at shaded-jar/target/otp-2.7.0-SNAPSHOT-shaded.jar. Is this expected?

@leonardehrenfried
Copy link
Member

leonardehrenfried commented Dec 4, 2024

I thought this was somehow backwards compatible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants