PluginVersionResolutionException in maven - maven-3

In my system previously C:\Users\abc after changed as C:\Users\xyz now the problem while running the maven with "mvn clean install" it rises exception as LocalRepositoryNotAccessibleException,it takes previous path "C:\Users\abc" but its not there in my system bcz i alreay changed to "C:\Users\xyz".And .m2 folder is not there in my C:\Users\xyz path so i explicitly given in settings.xml localrepository location as "C:\Users\xyz.m2\repository" now .m2 localrepository created above problem solved.But now another i faced another problem is i run command "
mvn clean install" it shows "PluginVersionResolutionException" but it recognize the correctly C:\Users\xyz but shows this exception.I check the plugin versions in my files correctly i specified.Please give me the solution and explain why it behaves like this?
Thanks

This means that you have defined a plugin dependency in your pom without specifing the version of the plugin.
As you have not specify the error message, I give you an example, an let you fix you own bug.
This is an example :
1/ I suppose that I execute the maven command > mvn intall -X
2/ in the console I have the folowing error :
[ERROR] Error resolving version for plugin 'org.codehaus.mojo:findbugs-maven-plugin' from the repositories ...
org.apache.maven.plugin.version.PluginVersionResolutionException: Error resolving version for plugin 'org.codehaus.mojo:findbugs-maven-plugin' from the repositories ...
3/ The error seems to be located in "findbugs-maven-plugin" dependency
4/ I go to my pom.xml file, and I search the dependency to the plugin, I will find that I haven't specified the version of the plugin. So I add it and it will be resolved
like this :
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>2.5.3</version> ==> I add this line to fix the pb
</plugin>

Related

having a problem running a build with jenkins and gatling

I'm getting the following error
[ERROR] No plugin found for prefix 'gatling' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\Users\w7116744\.m2\repository), central (https://repo.maven.apache.org/maven2)] -> [Help 1]
[ERROR]
If you already have the maven gatling plugin included in the POM, make sure that you run the maven gatling:test command in the directory where your POM is in.
The plugin doesn't check if a pom exist or not. If you are NOT running the mvn gatling:test command in the directory where your pom located, you will always get "No plugin found for prefix 'gatling' in the current project ....."
Looks like gatling-maven-plugin is not configured in your pom.xml.

Getting Error in POM.xml on KEPLER Eclipse

I have created maven based web application so after created application i am getting two errors in pom.xml which are
1.Multiple annotations found at this line:
- Failure to transfer org.apache.maven.plugins:maven-resources-plugin:pom:2.6 from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted
until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.6 from/to central (http://
repo.maven.apache.org/maven2): null to http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.6/maven-resources-plugin-2.6.pom
2.Multiple annotations found at this line:
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (execution: default-testCompile, phase: test-compile)
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (execution: default-compile, phase: compile)
- CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for
org.apache.maven.plugins:maven-compiler-plugin:jar:3.1: ArtifactResolutionException: Failure to transfer org.apache.maven.plugins:maven-compiler-plugin:pom:3.1
Could you please let me know what needs to be done for resolving the issue
If you are facing the same issue I described in my comment above then it seems I could fix it by running mvn eclipse:eclipse with working directory set to Eclipse project folder i.e.
$ cd /path/to/eclipse/workspace/Project
$ mvn eclipse:eclipse
Does this work for you ? Maybe your environment is different . Providing more details might help others to understand your problem even better so as to offer useful suggestions .
I had similar problem Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (execution: default-testCompile, phase: test-compile).
To Fix (apart from installing M2E plug-in and all):
Ensure installed maven is > 3.1 (using mvn -v). If not, you need to upgrade.
Ensure eclipse is pointing to correct maven location (Window->Preferences->Maven->Installations)
On Command prompt, go to project home directory and run mvn eclipse:clean and mvn eclipse:eclipse
Disable and enable Maven nature in eclipse (Right click on project, goto Maven -> Disable Maven Nature. To enable, Right click on project goto Configure -> Convert to Maven Project)

Error "The goal you specified requires a project to execute but there is no POM in this directory" after executing maven command

I have a pom.xml in C:\Users\AArmijos\Desktop\Factura Electronica\MIyT\componentes-1.0.4\sources\pom.xml and I executed:
mvn install:install-file -DgroupId=es.mityc.jumbo.adsi -DartifactId=xmlsec-1.4.2-ADSI -Dversion=1.0 -Dpackaging=jar -Dfile=C:\Users\AArmijos\Desktop\Factura Electronica\MIyT\componentes-1.0.4\core\xmlsec-1.4.2-ADSI-1.0.jar
however it returned the error below:
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.310s
[INFO] Finished at: Thu May 02 16:48:29 COT 2013
[INFO] Final Memory: 2M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM
in this directory (C:\Users\AArmijos). Please verify you invoked Maven from the
correct directory. -> [Help 1]
Can someone explain why it fails?
This link helped: https://stackoverflow.com/a/11199865/1307104
I edit my command by adding quotes for every parameter like this:
mvn install:install-file "-DgroupId=org.mozilla" "-DartifactId=jss" "-Dversion=4.2.5" "-Dpackaging=jar" "-Dfile=C:\Users\AArmijos\workspace\componentes-1.0.4\deps\jss-4.2.5.jar"
It's worked.
For any of those who are experiencing this on Windows and none of the above worked, try running this from cmd.exe. Executing these commands via PowerShell caused the install to fail each time.
On Windows when you are using PowerShell you have to enclose all parameters with quotes.
So if you want to create a maven webapp archetype you would do as follows:
Prerequisites:
Make sure you have maven installed and have it in your PATH environment variable.
Howto:
Open windows powershell
mkdir MyWebApp
cd MyWebApp
mvn archetype:generate "-DgroupId=com.javan.dev" "-DartifactId=MyWebApp" "-DarchetypeArtifactId=maven-archetype-webapp" "-DinteractiveMode=false"
Note: This is tested only on windows 10 powershell
Adding one more answer for Windows users. If none of this solves the problems.
Do not add space before or after =
-DgroupId= com.company.module //Wrong , Watch the space after the equal to
-DgroupId=com.company.module //Right
Its better to put everything inside double quotes, like "-DgroupId=com.."
This will give you exact error rather than some random error.
Weird that , maven does not even care to mention this in the documentation.
In my case, its because I copied pasted the command from the browser and it turned out that the dash was not the ASCII dash, just delete and type the dash again.
http://www.toptip.ca/2017/04/maven-most-weird-error-causing-failure.html
I was trying to install java jms-1.1.jar after downloading a copy from jboss repository.
Encountered exact same error and specifically on windows. Tried everything i.e. changed maven version / jdk version but no avail.
I was using the command below .
mvn install:install-file -DgroupId=javax.jms -DartifactId=jms -Dversion=1.1 -Dpackaging=jar -Dfile=jms-1.1.jar
Finally took a que from the comment in the main question and put every parameter value within double quotes
mvn install:install-file -DgroupId="javax.jms" -DartifactId="jms" -Dversion="1.1" -Dpackaging="jar" -Dfile="jms-1.1.jar"
This solved the problem. The issue seems very specific to windows environment. On ubuntu and mac the command works without any issues.
Totally true (When using PowerShell you need to put quotes). When I run the command and put quotes around the parameters that have a dot, it works. Instead of typing 1.4, you should type "1.4"
First time:
mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4 -DinteractiveMode=false
Error:
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (C:\Users\jcrojas\OneDrive - Superfinanciera\Personal\Aprendizaje\Maven\test). Please verify you invoked Maven from the correct directory. -> [Help 1]
Second time:
mvn archetype:generate -DgroupId="com.mycompany.app" -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion="1.4" -DinteractiveMode=false
...BUILD SUCCESS...
The command also works if it is run with the Windows command line, CMD. In this case, the quotation marks are not necessary.
Changing mvn clean to mvn clean --file *.pom fixed this issue for me.
On Windows, I got this error when running under a non-administrator command prompt. When I ran this as administrator, the error went away.
1.create a lib folder in your project file,
2.copy your jarFiles to the lib folder
3.right click on to your jarFile go to build path>Add to build path (now your jar file is part of your refrerenced libraries )
4.open command prompt and navigate to your project directory and write
mvn install: install-file "-Dfile=<yourJarFileName>.jar" "-DgroupId=<yourGroupID>" "-DartifactId=<yourArtifactId>" "-Dversion=<yourVersion>" "-Dpackaging=jar"
6.Rebuild your local repository index by opening in eclipse-
go to window>show view>other>maven>maven Repositories.
Right click on local Repositores and hit "RebuildIndex"
5.open your pom.xml file and add your dependency
<dependency>
<groupId><yourGroupID></groupId>
<artifactId><yourArtifactId></artifactId>
<version><yourVersion></version>
</dependency>
and run
mvn clean
mvn compile
mvn test
I got this error suddenly in Netbeans (but it worked from the command line) and it turns out some other program had changed the default directory of the command prompt. And because Netbeans runs "cmd /c" when invoking maven, it starts in an incorrect directory.
Check out in Regedit the value for
HKEY_CURRENT_USER\Software\Microsoft\Command Processor\Autorun
If it has been set, you probably should remove it to fix the problem. (1)
(I landed here when trying to resolve this issue, might not be 100% applicable to the current question - but might help others)
(1)
Changing default startup directory for command prompt in Windows 7
The execution of maven command required pom.xml file that contains information about the project and configuration details used by Maven to build the project. It contains default values for most projects.
Make sure that porject should contains pom.xml at the root level.
Add the Jenkinsfile where the pom.xml file has present.
Provide the directory path on dir('project-dir'),
Ex:
node {
withMaven(maven:'maven') {
stage('Checkout') {
git url: 'http://xxxxxxx/gitlab/root/XXX.git', credentialsId: 'xxxxx', branch: 'xxx'
}
stage('Build') {
**dir('project-dir') {**
sh 'mvn clean install'
def pom = readMavenPom file:'pom.xml'
print pom.version
env.version = pom.version
}
}
}
}
There may be a problem with Maven path configuration, if you used unix-like Operator System.
step 1: create new file in path ~/.bash_profile
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home
CLASSPAHT=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
PATH=$JAVA_HOME/bin:$PATH:
export JAVA_HOME
export CLASSPATH
export PATH
step 2: shell run source ~/.bash_profile OR modify zsh config file(add new line: source ~/.bash_profile)
Just watch out for any spaces or errors in your arguments/command. The mvn error message may not be so descriptive but I have realised, usually spaces/omissions can also cause that error.
I just added the path to the pom.xml as such
mvn -f path/to/pom.xml <goals> ...
Worked great for me
There could be some special characters added to your command like the '-' U+2013 and U+002d
Please remove the special characters and try the command
"The goal you specified requires a project to execute": The answer is in your question. I faced the same issue. Run the "mvn command" within the project folder, Also make sure sure its a maven configured project and hence contains the "POM.xml" file and you should be good to go!
Check for the name of the file, i.e pom.xml file is spelled correctly with proper file extension .xml.
Example for this error are
pom.ml
pm.xl
Please run it from the directory where POM.XML resides.

Failure in maven site plugin version 3?

I am trying to get a project to run the maven site:site goal using Maven 3.0.4. Unbeknownst to me, it had been running under Maven 2.2.1 (when I thought it should have been 3).
I keep getting the following failure:
Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.0:site (default-cli) on project myproj-parent: Execution default-cli of goal org.apache.maven.plugins:maven-site-plugin:3.0:site failed: For artifact {null:null:null:jar}: The groupId cannot be empty.
How do I even find what artifact is missing groupId?
It turns out the POM file for one of my dependencies was corrupt. The POM for joda-jsptags-1.0.2 in our Nexus repository wasn't a POM, but a fragment of HTML.
Getting a clean version of joda-jsptags fixed this issue.
It was just frustrating not to get any sort of idea what was bad. And apparently the Maven 3 plugins are more strict on POM parsing.
If you are migrating from Maven 2.2.1 to Maven 3.0.4 you have to be aware of some difference in particular in relation with site generation. You should have taken a look the the migration docs and take a look if your pom needed to be fixed.
Missed a link.

SAXParseException Using Maven-JAXB2 0.7.5 Plugin, Only On Maven 3

I seem to be having issues with the maven-jaxb2-plugin (Version 0.7.5) when using Maven 3. The issue doesn't occur when using Maven 2.2.x, and it only became an issue when I upgraded to Maven 3.
Following is the maven output after executing mvn clean test:
[ERROR] Error while parsing schema(s).Location
[ file:/C:/dev/smart-07-2011/mpg-money-send-service/src/main/resources/META-INF/mpg/schemas/XRSIMoneySend.xsd{218,45}].
org.xml.sax.SAXParseException: src-resolve:
Cannot resolve the name 'common:ResponseBody' to
a(n) 'type definition' component.
However, the tests execute fine when using Maven 2. I've been searching for resources online if there's any known issue between Maven 3 and JAXB2, but I couldn't find any resources. Effective POM for the build using Maven 2 or Maven 3 is identical.
Incidentally, in the past I was able to use the maven-jaxb2-plugin on Maven 3 just fine; this build, however is special in that the XSD is in a dependent JAR, so it could be a configuration issue; but I'm not sure what configuration I would need to set in the POM or bindings.
Are there any resources I could use to resolve this issue, or any resolution steps I could take? Thanks a lot!

Resources