Use IntelliJ to debug a Gradle Execute Task - intellij-idea

I have the following Gradle task:
task execute(type:JavaExec, dependsOn:['build']) {
main = 'com.something.Main'
classpath = sourceSets.main.runtimeClasspath
}
When I debug the task in IntelliJ I get the following error:
ERROR: transport error 202: connect failed: Connection refused
FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [debugInit.c:750]
:execute FAILED

It seems later versions of IntelliJ Idea cannot connect debuggers to forked test runners when using the Gradle Test runner.
In your sources root, add a gradle.properties file with the next two lines:
maxTestForks = 1
testForkEvery = 0
That should do the job.

I had a very similar problem. When I was invoking Gradle in IntelliJ, the Java environment by default contained
JAVA_OPTS=-agentlib:jdwp=transport=dt_socket,address=127.0.0.1:59842,suspend=y,server=n
I removed the JAVA_OPTS from the environment all together and voila, no more JDWP error because no more JDWP.

Related

Unable to create quarkus project on intellij

Getting the following error:
Initialization failed for 'https://code.quarkus.io' Please check URL, network and proxy settings. Error message: Cannot download 'https://code.quarkus.io/api/extensions': code.quarkus.io
Can't figure out where to start with this issue

chromium-ozone-wayland cannot init wayland platform and connect to wayland display

I built chromium-ozone-wayland successfully but im getting error on runtime.
Error Output :
ERROR : XDG_RUNTIME_DIR not set in the environment
ERROR:wayland_connection.cc(218) Failed to connect to wayland display: no such file or directory(2)
ERROR:ozone_platform_wayland.cc(220) Failed to initialize wayland platform
ERROR:env.cc(255) The platform failed to initialize. exiting.
I used this repo : https://github.com/OSSystems/meta-browser/tree/master/meta-chromium
What could it be caused by?

IntelliJ Error When Importing Rust Project

I wanted to work on a Rust project and wanted to use IntelliJ and for this I installed Rust plugin:
https://plugins.jetbrains.com/plugin/8182-rust/docs/rust-quick-start.html
I then imported my project in IntelliJ, but somehow I'm not able to see the gutter menu next to my test case. I do not understand what I'm missing. I can see at the bottom in the Build window that there is something that fails.
Updating Workspace Info.
Execution failed (exit code 1).
/home/joesan/.cargo/bin/cargo metadata --verbose --format-version 1 --all-features
stdout : error: no override and no default toolchain set
error: backtrace:
error: 0: error_chain::backtrace::imp::InternalBacktrace::new
1: rustup::config::Cfg::find_or_install_override_toolchain_or_default
2: rustup_init::main
3: std::rt::lang_start_internal::{{closure}}::{{closure}}
at /rustc/c7087fe00d2ba919df1d813c040a5d47e43b0fe7/src/libstd/rt.rs:52
std::sys_common::backtrace::__rust_begin_short_backtrace
at /rustc/c7087fe00d2ba919df1d813c040a5d47e43b0fe7/src/libstd/sys_common/backtrace.rs:130
4: main
5: __libc_start_main
6: <unknown>
stderr :
rustup show gave me the following:
Default host: x86_64-unknown-linux-gnu
rustup home: /opt/softwares/rustup
stable-x86_64-unknown-linux-gnu (default)
rustc 1.46.0 (04488afe3 2020-08-24)
Any ideas how to get this fixed?
I fixed it by opening the Rust project in IntelliJ, navigate to File -> Settings -> Rust and then set the Standard library to the following:
/opt/softwares/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib
That is the location where I installed the Rust Toolchain. Somehow Intellij was not picking it up and I had to set it manually.

Adding sub module to project causing gradle build failures in Android studio 3.0 with gradle version 4.1

I added sub module library vertical-stepper-form version 0.9.8, while I set dependency of this library on my app module. I was able to do it successfully.
I am using Android Studio 3.0 with gradle version 4.1, few of the classes in project are in kotlin and others in java
When I started gradle sync it gave me this error. The gradle is not building and showing below issues :
/*********************************/
Information:Gradle tasks [:vertical-stepper-form:generateDebugSources,
:vertical-stepper-form:generateDebugAndroidTestSources,
:vertical-stepper-form:mockableAndroidJar,
:app:generateInstallDebugSources,
:app:generateInstallDebugAndroidTestSources, :app:mockableAndroidJar]
D:\Devavrata\project/package/src/main/res/abc.xml Error:error:
attribute 'com.spireon.install:src' not found.
D:\Devavrata\AbcProject\abc-Android\app\build\intermediates\incremental\mergeInstallDebugResources\stripped.dir\layout\activity_main.xml
Error:attribute 'com.spireon.install:src' not found. Error:failed
linking file resources. Error:java.util.concurrent.ExecutionException:
java.util.concurrent.ExecutionException:
com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for
details Error:java.util.concurrent.ExecutionException:
com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for
details Error:com.android.tools.aapt2.Aapt2Exception: AAPT2 error:
check logs for details Error:Execution failed for task
':app:processInstallDebugResources'.
Failed to execute aapt Information:BUILD FAILED in 24s Information:7 errors Information:0 warnings Information:See complete output in
console
/********************************/
What I have already tried :
I tried with changing import lines in xml also changing the android:src and srcCompat properties. Along with build/project cleaning and invalidating the cache.
Changing this line in gradle.properties
android.enableAapt2=false
Let me know if anyone has faced this issue

Cargo start up error

I am running 'mvn clean install -Dmaven.test.skip=true' command for a web application. but it gives following error. I set the catalina home as an environment variable. i am using maven 3.1.1 version. Please help me
FATAL ERROR in native method: JDWP No transports i
nitialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)
[WARNING] [talledLocalContainer] ERROR: transport error 202: bind failed: Addres
s already in use
[ERROR] Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.2.4:star
t (start-container) on project RCMigrationWebApp: Execution start-container of g
oal org.codehaus.cargo:cargo-maven2-plugin:1.2.4:start failed: Failed to start t
he Tomcat 7.x container. Deployable [http://localhost:8080/cargocpc/index.html]
failed to finish deploying within the timeout period [120000]. The Deployable st
ate is thus unknown. -> [Help 1]
Probably you have to kill any process running at 8080, looks like the port is already in use..
ERROR: transport error 202: bind failed: Address already in use
Port in use. Run netstat -bv if you are using Windows. You will get to know which process is holding up the port. With your stackTrace, it looks very obvious.
Let me know if it helps.