question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to build Netty 4.1 in IntelliJ for its JDK7+ dependencies?

See original GitHub issue

This is perhaps a dumb question, but how am I supposed to build Netty 4.1 in IntelliJ for its JDK7+ dependencies? If I do a fresh clone of Netty/4.1 and open it in IntelliJ, the build fails due to:

Executing pre-compile tasks...
Loading Ant configuration...
Running Ant tasks...
Running 'before' tasks
Checking sources
Copying resources... [netty-resolver]
Copying resources... [netty-buffer]
Copying resources... [netty-common]
Copying resources... [netty-codec]
Copying resources... [netty-transport]
Copying resources... [netty-handler]
Copying resources... [netty-codec-http]
Parsing java... [netty-common]
java: Errors occurred while compiling module 'netty-common'
Checking dependencies... [netty-common]
Dependency analysis found 0 affected files
javac 11.0.10 was used to compile java sources
Finished, saving caches...
Compilation failed: errors: 48; warnings: 7
Executing post-compile tasks...
Loading Ant configuration...
Running Ant tasks...
Synchronizing output directories...
3/8/21, 8:27 PM - Build completed with 48 errors and 7 warnings in 10 sec, 766 ms

Errors like, e.g.,

Screen Shot 2021-03-09 at 5 06 44 PM

.../netty/common/src/main/java/io/netty/util/internal/PlatformDependent.java:141:48
java: cannot find symbol
  symbol:   class ThreadLocalRandom
  location: package java.util.concurrent

This is with the IntelliJ Project SDK set to JDK11 and the project language level set to 11:

Screen Shot 2021-03-09 at 5 11 56 PM

I see that individual modules have their language level set lower, but I’m assuming I don’t need to manually modify all of those.

I understand that Netty conditionally checks the JDK version at runtime to determine behavior, but I’m not sure how to fix this in IntelliJ and/or Maven so that I can run unit tests and the like. I’ve been resorting to running unit tests from the command-line, which is not great for debugging.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
Scottmitchcommented, Mar 10, 2021

I’ve experience the same issue. Default configuration resulting in broken project is painful. I wonder if the way we are configuring the pom file (or idea) can be improved, or if this is a idea issue. seems like this will continue to impact folks re-initializing their environment IIUC.

https://www.jetbrains.com/help/idea/java-compiler.html#compiler

By default, this option is selected. IntelliJ IDEA deduces from project settings when the cross-compilation is needed and automatically applies the --release compiler option for Java 9.

1reaction
Bennett-Lynchcommented, Mar 10, 2021

Mine was checked (by default). Unchecking it fixed it. I can now build and run tests in the IDE. Thanks @chrisvest!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to set up Netty dependency into intellij IDE - Stack Overflow
Change your IDEA config of project. Settings -> Build, Execution, Deployment -> BuildTools -> Maven. Check maven home path, user settings ...
Read more >
Module dependencies | IntelliJ IDEA Documentation - JetBrains
When you compile or run your code, the list of module dependencies is used to ... Module Dependency: select another module in the...
Read more >
Setting up development environment - Netty.docs
Use 64-bit operating system · Install the necessary build tools · Verify the build · Set up IntelliJ IDEA · Set up Eclipse...
Read more >
I have problem with IntelliJ - java help on CodeGym
this is my the only thing that is shown after I press run all of this error is : "C:\Program Files\Java\jdk-13.0.1\bin\java.exe" ...
Read more >
Netty · Delft Students on Software Architecture: DESOSA 2017
Suppliers, Libraries which Netty depends on, Java, IntelliJ ... Another instance of Netty dependency is shown by its license usage since Netty is ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found