IntelliJ - Why does the target folder is created with an padlock? - maven

I hope you guys can help me with this, after running testng, the target folder is created with a padlock
and due this I can't run mvn clean test cause this folder can't be removed by maven
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project TestCases: Failed to clean project: Failed to delete /Users/administrator/qa-automation/01LoginProject/TestCases/target/surefire-reports/testng.css -> [Help 1]
How can I prevent the target from being created without the padlock?

Padlock on a project folder means it contains a read-only class.
See this article for more information on file types and icon references in IntelliJ IDEA.

Related

How to solve Exception: basedir doesnot exist

I am trying to dockerize a springboot project using maven.
So i ran a command
mvn package -Pdocker '-Dmaven.test.skip=true' docker:build
Below is the image of how the file structure of the project is
image and below is the error
[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:1.0.0:build (default-cli) on project poplar: Exception caught: basedir C:...\server\target does not exist -> [Help 1]
I am trying to find out how i can solve the problem because from the project structure there is no target folder for the root project poplar though the subprojects have target folders in them.
An easy fix is to create the target directory in the base project directory. For more details about the issue see here. The error is reproduced here
I would suggest you change the project structure and add a maven sub-module responsible for building the docker container.

We have a case where there are multiple projects configured in sonar. All the project have different modules with same names?

We have a case where there are multiple projects configured in sonar. All the project have different modules with same names.
With this, as and when we execute sonar for one of the project, the execution is getting terminated with below error.
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.6:sonar (default-cli) on project XXX: Module "XXXX" is already part of project "YYYY" -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.6:sonar (default-cli) on project XXXX: Module "YYYY" is already part of project "YYYY"
It seems that because the module name is same , Sonar is terminating the execution. Note that we are using sonar version 4.5.5 and facing this issue. While earlier we were using sonar version 4.1.1 and with that version the execution was successful (probably sonar was overriding earlier report with the newer one in case of conflicting module name).
Please suggest possible solution for this? Thanks,
Complete error log is available here
https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/sonarqube/-L7cby77-28/6L6zPlb6AAAJ
I think you need to rename you modules like if your project is abc.
Please change your modules like abc_xxx etc...it may work for you
Have you tried using the project name property?
In a pom.xml file:
<sonar.projectName>Some project name here</sonar.projectName>

maven in Teamcity build creates maven-metadata-snapshots.xml containing NUL?

What are the reasons it could create a maven-metadata-snapshots.xml filled with 'NUL' characters?
This build runs fine on local machine. Issue observed on the Team city build machine/agents.
More to this question - How is a maven-metadata-snapshots.xml generated in the entire maven build flow?
What all stages and files are created from pom.xml untill the stage of creating a maven-metadata-snapshots.xml?
My current Teamcity build breaks with -
Step 1/1: Maven: Main Build (Maven) (6m:35s)[08:46:43][Step 1/1] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project : Failed to update metadata project/maven-metadata.xml: Could not parse metadata D:\Apps\TeamCityBuildAgent2\work\m2-repo\maven-metadata-snapshots.xml: only whitespace content allowed before start tag and not \u0 (position: START_DOCUMENT seen \u0... #1:1) [08:47:27][Step 1/1] Step Maven: Main Build (Maven) failed.
How to control the encoding of this file?
This shows that the maven project metadata is corrupted.
To resolve this -
1) Login to project repo as admin
2) Create a task to recreate the project metadata.
3) The task could be a one-time run, or you could schedule it perodically if it is a persisten issue in your project environment.
This helped me!

SonarQube scan failing with "is already part of project XXX error is already part of project"

Recently I upgraded sonarqube from 4.0 to 4.3.3. Post upgrade when I try to run the maven build I am getting the error:
Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.4:sonar (default-cli) on project xxx on project yyy Module "abc.def.xyz" is already part of project of other project.
The issue is we scan on multiple branches so we will have modules with the same name.
Is there a way to turn off this validation?
Assume you have multiple modules Maven project with below structure:
com.company:project
com.company:project-module1
com.company:project-module2
In your java source code, now "com.company:project" renamed to "com.company:myProject", so new java source strucutre becomes:
com.company:myProject
com.company:project-module1
com.company:project-module2
When you build new source and push analysis data to Sonar, it prompt:
[ERROR] Failed to execute goal
org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar
(default-cli) on project myProject: Module
"com.company:project-module1" is already part of project
"com.company:project" -> [Help 1]
This error is because the "com.company:project-module1" already executed and registered into Sonar before and now it belongs to "com.company:project" project whihc no longer exist in your source code anymore.
Solution:
In Sonar project configuration --> Update key, change the project "com.company:project" key from "com.company:project" to "com.company:myProject", rerun Maven build and push to Sonar, issue will solve.

Maven deployment issues

I have a maven project that is built using the archetype-site.
I left the default directory structure as it is and added a directory for my files, so my current structure is this:
MyProject
-> src
-> pages
-> target
-> pom.xml
The pages directory is the one I added and it has a variety of HTML/CSS/JS files.
I've defined a remote repository on my pom.xml and have added the credentials to the relevant section in the settings.xml file of maven.
I'm getting the following error which I do not understand when I'm trying to deploy. Googling also did not help.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project MyProject: Failed to deploy artifacts: Could not find artifact MyProject:MyProject:jar:1.0-20121022.153807-1 in MyProject (https://bitbucket.org/MyApp/MyProject) -> [Help 1]

Resources