Test framework quit unexpectetly; agent library failed to init: instrument - maven

Every time I'm starting a debug in IntelliJ I receive:
Error occurred during initialization of VM
agent library failed to init: instrument
Failed to find Premain-Class manifest attribute in /Users/me/.m2/repository/org/jetbrains/kotlinx/kotlinx-coroutines-core/1.4.3/kotlinx-coroutines-core-1.4.3.jar
Process finished with exit code 1
I already
Restarted, invalidated caches
Updates all dependencies in the POM
Re-downloaded the project
Reset the project to various old branches
Deleted local maven cache
It only occurs when I want to debug. Test, compile, run, all works - just debug doesn't. Debug works as usual on all other projects.
Has anyone an idea what the hell is going on?

There was an issue: KTIJ-17927 Debugger: "Failed to find Premain-Class manifest attribute" when debugging main function in jvmMain in MPP with coroutines
The workaround is to set File | Settings | Build, Execution, Deployment | Debugger | Data Views | Kotlin | Disable coroutine agent option. Or update to the latest IDE and Kotlin plugin version where it should be fixed.

Related

Maven failed to clean project while building a second time

I'm facing a very strange behavior on my laptop...
I have a maven project (loaded with Visual Studio Code) building a WAR file to be deployed on a remote server.
Project compilation worked properly since yesterday but today, I'm only able to launch only once the clean install...until I reboot my laptop...
here is the command launched (the second time which cause the error):
mvn clean
....
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:3.1.0:clean (default-clean) on project my-backend: Failed to clean project: Failed to delete M:\dev\my-backend\target\my-backend\WEB-INF\lib\plexus-utils-3.3.0.jar -> [Help 1]
I'm trying to delete the target folder manually but It seems that there is another program who access this folder but I do not have anything running on my laptop, no server, no IDE (I Stopped Visual Studio Code).
I even tried to close every windows (even GitBash used to launch mvn commands) but I'm still getting this lock file issue....the only solution is to reboot my laptop !
since yesterday I didn't change anything on my pom.xml file...I'm really stucked...
EDIT 1:
I also checked with other Maven Projects I have and I'm getting the same result. After reboot I can build (mvn clean and mvn install) without any problem but at the end of the build, Windows is adding a lock on the files target/my-backend/WEB-INF/lib
Even if I try to unlock the lib folder (with UnlockIT for instance) the unlock cannot be performed and there is no process handling the lock...
any idea why I'm getting this lock and how to remove it ?

"The input changes require a full rebuild for incremental task ':compileKotlin'." When Gradle building

Enviroment:
gradle-6.5.1
Kotlin
JSF
Hello everyone.
I had to move from Intellij because my licence expired And I was trying to buil my project using Gradle(As I was already doing before) using VS Code.
When I try to run my project with the usual gradle build -info --build-cache so when I try to compile my kotlin code it gets stack in the same part every single time:
> Task :compileKotlin
Deleting stale output file: C:\Users\Usuario\Desktop\cloud\build\classes\kotlin\main
Build cache key for task ':compileKotlin' is 3bd7d5460a493fb5a0944ec8a3be0e80
Task ':compileKotlin' is not up-to-date because:
No history is available.
The input changes require a full rebuild for incremental task ':compileKotlin'.
Using Kotlin/JVM incremental compilation
<-------------> 0% EXECUTING [4m 16s]
> :compileKotlin
It dosen't throw an error, it just stays like so for hours and hours.
I also updated from gradle-5.2.1(It didn't ork in that version neither) but when running the scan my gradle.build doesn't seem to have any problems, just some deprecated but still useful instructions: My scan results
Does anyone have an idea of what could be happening?

Can Gradle restart running app in continuous build mode run?

With gradle run -t my java application restarts nicely after exit whenever a src file changed. But can I use Gradle to terminate a running app and restart it?
I can see using -d that Gradle detects the change while my app is running.
[DEBUG] [org.gradle.internal.filewatch.jdk7.WatchServiceFileWatcherBacking] Received file system event: FileWatcherEvent{type=MODIFY, file=/usr/src/app/src/main/java/App.java}
[DEBUG] [org.gradle.internal.filewatch.jdk7.WatchServiceRegistrar] Calling onChange with event FileWatcherEvent{type=MODIFY, file=/usr/src/app/src/main/java/App.java}
But as documented restart requires that "the build task and its dependencies complete without error".
I'm running in Docker, hence the IDE's support for compile during run can't be used. For Node.js I use Nodemon for this kind of development setup.
I no longer think that this would make Java development any more efficient. See https://discuss.gradle.org/t/how-to-restart-a-run-in-continuous-mode/23221/11.

Maven surefirebooter

I'm using Jenkins to build my projects on Maven 3.
There is ~15 jobs defined. They are running onCommit or by cron expression all day long (mostly once per hour). Some jobs are using Sonar (XXXDailyBuild not).
Sometime I'm facing error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean (default-clean) on project xxx: Failed to clean project: Failed to delete E:\CI\data\jobs\XXXDailyBuild\workspace\XXX\xxx\target\surefire\surefirebooter8004371362793469171.jar -> [Help 1]
It is caused by locked Jenkins workspace by active java process of surefirebooter8004371362793469171.jar
Jenkins job runs with 'Execute concurrent builds if necessary' disabled.
Any other job/process do not use 'XXXDailyBuild' workspace.
I'm trying to figure out what's going on.
Is there any way to dump running 'surefirebooter8004371362793469171.jar' process to analyze their heap?
Problem has been investigated:
Our application runs JUnit tests by surefirebooter maven plugin jar
Every tests need fresh models state
During models initialization old models state are disposed and fresh are initialized
Some models starts threads ie. Directory Watcher
The root PROBLEM is:
1. when some test fails in step 3. old models state aren't disposed
and this way some threads aren't stopped (duplicated on every test fail)
It was easy to check it using jvisualvm tool.
Finally, after maven test run process stays active forever.
Hope this analysis help someone!
Don't know the root cause and resolution. However, you can kill the java.exe from Task Manager (in Windows). This java.exe holds a lock on surefirebooter.jar file. Killing java.exe will Release that lock and you will be able to run the Maven Build.

Failed to start build on agent because of Snapshot dependency failure

I've configured build chain on TC.
When some build fails, dependent build shows error "Failed to start ... build on agent ..." and "Snapshot dependency failure".
Dependent build is configured to start ONLY in case of previous build succeeded. Also dependent build is configured to have the same build id as it's dependency (correspond to revision number) and thus I'm able to see last successfull commit that had been passed "the testing chain". With this in mind I don't see any advantages in "Failed to start" error message to be shown, in contrary my project page on TC is less readable. How could I configure TC not to show it?
Thanks.

Resources