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

Add start of Java Web Build Examples page #3274

Merged
merged 15 commits into from
Jul 22, 2024
Merged

Conversation

lihaoyi
Copy link
Member

@lihaoyi lihaoyi commented Jul 19, 2024

Simple hello-world projects using Spring Boot and Jetty. We can expand it more in future

@lihaoyi
Copy link
Member Author

lihaoyi commented Jul 19, 2024

Not sure why example.javaweb[1-hello-spring-boot].local.test passes on my machine and fails in CI. Maybe some kind of mac vs linux thing?

@lefou
Copy link
Member

lefou commented Jul 19, 2024

example.javaweb[1-hello-spring-boot].local.test

I get the same error on my Gentoo Linux machine.

[2144/2144] example.javaweb[1-hello-spring-boot].local.test 
-------------------------------- Running Tests --------------------------------
/home/lefou/work/opensource/mill/out/example/javaweb/1-hello-spring-boot/local/workspaceDir.dest> 'mill' 'test'
--- Expected output --------
...com.example.HelloSpringBootTest#shouldReturnDefaultMessage() finished...
----------------------------
/home/lefou/work/opensource/mill/out/example/javaweb/1-hello-spring-boot/local/workspaceDir.dest> 'mill' 'runBackground'
--- Expected output --------

----------------------------
/home/lefou/work/opensource/mill/out/example/javaweb/1-hello-spring-boot/local/workspaceDir.dest> 'curl' 'http://localhost:8080'
--- Expected output --------
...<h1>Hello, World!</h1>...
----------------------------
X mill.example.ExampleTestSuite.exampleUsage 23315ms 
  java.util.concurrent.ExecutionException: java.net.ConnectException: Verbindungsaufbau abgelehnt
    java.util.concurrent.FutureTask.report(FutureTask.java:122)
    java.util.concurrent.FutureTask.get(FutureTask.java:205)
    mill.example.ExampleTestSuite$.retryOnTimeout$1(ExampleTestSuite.scala:61)
    mill.example.ExampleTestSuite$.$anonfun$tests$3(ExampleTestSuite.scala:78)
  java.net.ConnectException: Verbindungsaufbau abgelehnt
    sun.nio.ch.Net.pollConnect(Net.java:-2)
    sun.nio.ch.Net.pollConnectNow(Net.java:672)
    sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:547)
    sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:602)
    java.net.Socket.connect(Socket.java:633)
    sun.net.NetworkClient.doConnect(NetworkClient.java:178)
    sun.net.www.http.HttpClient.openServer(HttpClient.java:533)
    sun.net.www.http.HttpClient.openServer(HttpClient.java:638)
    sun.net.www.http.HttpClient.<init>(HttpClient.java:281)
    sun.net.www.http.HttpClient.New(HttpClient.java:386)
    sun.net.www.http.HttpClient.New(HttpClient.java:408)
    sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1309)
    sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1242)
    sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1128)
    sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:1057)
    sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1687)
    sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1611)
    java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:529)
    requests.Requester$$anon$1.liftedTree1$1(Requester.scala:267)
    requests.Requester$$anon$1.readBytesThrough(Requester.scala:266)
    geny.Readable.writeBytesTo(Writable.scala:93)
    geny.Readable.writeBytesTo$(Writable.scala:93)
    requests.Requester$$anon$1.writeBytesTo(Requester.scala:164)
    requests.Requester.apply(Requester.scala:113)
    mill.example.ExampleTestSuite$.processCommand(ExampleTestSuite.scala:131)
    mill.example.ExampleTestSuite$.processCommandBlock(ExampleTestSuite.scala:106)
    mill.example.ExampleTestSuite$.$anonfun$tests$6(ExampleTestSuite.scala:80)
    mill.example.ExampleTestSuite$.$anonfun$tests$6$adapted(ExampleTestSuite.scala:80)
    scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
    mill.example.ExampleTestSuite$.$anonfun$tests$5(ExampleTestSuite.scala:80)
    mill.example.ExampleTestSuite$.$anonfun$tests$2(ExampleTestSuite.scala:59)
    java.util.concurrent.FutureTask.run(FutureTask.java:264)
    java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    java.lang.Thread.run(Thread.java:840)
Tests: 1, Passed: 0, Failed: 1
1 targets failed
example.javaweb[1-hello-spring-boot].local.test 1 tests failed: 
  mill.example.ExampleTestSuite mill.example.ExampleTestSuite.exampleUsage

@lefou
Copy link
Member

lefou commented Jul 19, 2024

Could be a race condition. Spring takes some while to boot, but runBackground returns before it's finished.

@lefou
Copy link
Member

lefou commented Jul 19, 2024

We probably need to add sleep to the set up supported commands in ExampleTestSuite.

@lihaoyi
Copy link
Member Author

lihaoyi commented Jul 21, 2024

@lefou you were right, seems its just a matter of github actions runners being slower than my laptop

@lihaoyi lihaoyi requested review from lefou and lolgab July 21, 2024 10:17
Copy link
Member

@lefou lefou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Is there a reason you use Spring 2.5.x instead of 3.x? Is it JVM compatibility?

@lihaoyi
Copy link
Member Author

lihaoyi commented Jul 22, 2024

@lefou just happened to be the version used in the example I read on someone's blog IIRC

@lihaoyi lihaoyi merged commit 4e94cc2 into com-lihaoyi:main Jul 22, 2024
39 checks passed
@lefou lefou added this to the 0.11.10 milestone Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants