Maven failed to clean project while building a second time - maven

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 ?

Related

Maven resources compiler: Failed to copy xx to yy: Couldn't copy xx to yy

Getting the following error during build/rebuild in Intellij v.2022.2.3.
Maven resources compiler: Failed to copy 'absolute_path_to_module/src/test/test-resources/test-app-camel-settings.properties' to 'absolute_path_to_module/target/test-classes/.': Couldn't copy [absolute_path_to_module/src/test/test-resources/test-app-camel-settings.properties] to [absolute_path_to_module/target/test-classes/.]
Tried the following but still getting the same issue:
build and rebuild project/module
mvn clean install
invalidate caches and restart
reverted all project changes to last time it was working
Was working earlier, only made normal code changes
Solved it by deleting the old resources folder and creating a new one

why my jenkins is stuck while checking out a project via SVN?

I have downloaded eclipse and with it I have checked out a project available via SVN, the project is named "Simulation" and is available at an address, with eclipse I can do everything but my main job is to build that project via Jenkins so I have created a maven project that gets the code from SVN: some_address/svn/Simulation and I configured it to build every 2 minutes but 30 minutes passed and here is the log from build #1:
Started by user %USERNAME%
Started by timer
[EnvInject] - Loading node environment variables.
Building in workspace C:\Program Files (x86)\Jenkins\workspace\simulation
Checking out a fresh workspace because there's no workspace at C:\Program Files (x86)\Jenkins\workspace\simulation
Cleaning local Directory .
Checking out http://some_address/svn/Simulation at revision '2019-02-26T09:30:18.376 +0100' --quiet
Using sole credentials devops/****** in realm ‘<http://some_address> VisualSVN Server’
now, I am able to ping successfully to that address and like I said before, I checked out the project with eclipse
what am I doing wrong?

Bamboo build error: How to properly clean bamboo caches?

The problem:
Bamboo executes old unit tests that don't exist my current develop branch which causes a build error.
The situation that causes this problem:
After a big refactoring process of my maven java project, where I basically moved, modified and renamed every file, I committed my changes to my remote repository.
That triggered my bamboo build plan, to start the build process.
The git code checkout seems to work, but the next step, running the unit tests, fails!
Looking in the log file I see that an old, no more existing java Unit test class gets executed and of course fails because of NullPointerExceptions.
Things I tried to fix this problem
A. Remove caches in the Administration section
I went to Bamboo->Administration->Repository Settings and selected
the cache of my project and deleted it.
I started the build plan again
BUILD ERROR ! Same problem
B. Delete the cache directory in the file system
Start a RDP session on the bamboo server
stop bamboo
go to D:\bamboo-home_64\xml-data\build-dir_git-repositories-cache
delete all files in this folder
start bamboo
start the build plan again
BUILD ERROR! same problem
Meta info
bamboo version: 6.1.0 build 60103 - 18 Jul 17
I don't know what I can do to fix this..
There's Clean working directory task. Add it as first task to your Job and see if it solves the issue.

How to avoid unneeded recompilation from IntelliJ Idea 13 when it runs a maven vaadin project created in the command line

I have created a maven vaadin project using the command line like this:
mvn archetype:generate -DarchetypeGroupId=com.vaadin -DarchetypeArtifactId=vaadin-archetype-application -DarchetypeVersion=7.1.9
Then I change into the folder of the application and I give at the command line the following :
mvn install
After waiting for the application to compile, I open it using IntelliJ Idea (by opening the pom.xml file), I add Tomcat Server and I press run.
Then the IntelliJ Ide recompiles the application again.
Is there any way I can avoid this second compilation?
Thank you.
You should have tomcat configured as a server, and configure your module(s) to deploy at server startup. On the run configuration you will see a list of things to do before launch. It will probably say Make -- you can remove this if you need to.
However, you probably should allow idea to do this for you and really stop doing it on the command line. Idea can handle more complex build patterns for you. You should trust it.

Liferay theme development using JBoss on Mac

I am creating liferay themes using JBoss on my Mac. In the process of creating a theme, when I execute ant deploy on my terminal, I am getting following errors:
Buildfile:
/Users/saif/Desktop/Liferay/liferay-plugins-sdk-6.1.1/themes/g2y-b2b-theme/build.xml
[copy] Copying 1 file to /usr/share/ant/lib
BUILD FAILED
/Users/saif/Desktop/Liferay/liferay-plugins-sdk-6.1.1/themes/g2y-b2b-theme/build.xml:5:
The following error occurred while executing this line:
/Users/saif/Desktop/Liferay/liferay-plugins-sdk-6.1.1/themes/build-common-theme.xml:7:
The following error occurred while executing this line:
/Users/saif/Desktop/Liferay/liferay-plugins-sdk-6.1.1/build-common-plugin.xml:5:
The following error occurred while executing this line:
/Users/saif/Desktop/Liferay/liferay-plugins-sdk-6.1.1/build-common.xml:68:
Failed to copy
/Users/saif/Desktop/Liferay/liferay-plugins-sdk-6.1.1/lib/ecj.jar to
/usr/share/ant/lib/ecj.jar due to java.io.FileNotFoundException
/usr/share/ant/lib/ecj.jar (Permission denied)
Total time: 0 seconds
Please help me to get rid of this and proceed further. What are the steps I should take in order to do this on a Mac? Please also tell me how to set up the environment variable of ANT on a Mac.
When ant builds your theme and requires ecj.jar (the eclipse compiler for java) it typically downloads it from some internet repository and places it in $ANT_HOME/lib. It seems your $ANT_HOME is usr/share/ant and you don't have write access to that directory. Either download it manually and place it there or open up the directory write permissions for one build (then close it again).
You'll only need to do this once: When ecj.jar is on the classpath for ant, it will just be used for eternity.

Resources