I've even rebooted my machine a couple times, but the OS does not always recognize the maven command. But when I execute either, cd %M2_HOME%, or cd %M2% it brings me to the installation directory. I've also made sure to add the user variable M2 to the Path system variable.
I solved this by creating all under user variables (including the PATH variable).This is because the system variables do not "translate" the user variables.So if you only want to use maven in your account, you need to add another PATH variable as a user variable, not system variable.
As others have done, creating new System variables M2 and M2_HOME solved the problem. Just making User variables M2 and M2_HOME on my Windows XP machine led to maven not being recognised from the command line. I then deleted the User variables, created copies as System variables and it all came to life.
I had similar issue on Windows 7. At first I setup M2, M2_HOME under User variable but when I echoed %PATH% , I did not see maven bin directory listed under PATH. Then I setup M2, M2_HOME under system variable and it worked.
N.B my %M2_HOME% is pointing to %MV3_HOME% instead of actual absolute path bcos I have multiple version of maven installed and trying to be clever (switch between maven versions on the same box for different project).
I was facing the same issue while executing the command mvn -version; however, I checked I had also set the mvn options in the environment variables setting, which gave me some Heap memory issue on the command prompt. So, I removed the maven options that I had set and then it worked fine for me.
Could not calculate build plan: Plugin org.apache.maven.plugins:maven-jar-plugin:2.4 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-jar-plugin:jar:2.4
Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: Failure to transfer org.apache.maven.plugins:maven-jar-plugin:pom:2.4 from was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced.
I have in trouble with this problem too, and my output is Could not calculate build plan: Plugin org.apache.maven.plugins:maven-war-plugin:2.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-war-plugin:jar:2.2 Plugin org.apache.maven.plugins:maven-war-plugin:2.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-war-plugin:jar:2.2
In my case, after stoping eclipse, just going to the path that it was complaining about, in your case will be:
"C:/Users/yourUser/.m2/repository/org/apache/maven/plugins/maven-war-plugin" and deleting all the files then starting eclipse has resolved the issue.
Adding 'maven-war-plugin' worked for me. Actually in my .m2\repository\org\apache\maven\plugins folder there are two versions of maven-war-plugin available. So, I updated it with the latest version(in my case from 2.1.1 to 2.2).
The problem with me was related to the project I was working last year, which required a certain proxy on maven settings (located at \maven\conf\settings.xml and C:\Users\\.m2\settings.xml). The proxy was blocking the download of required external packages.
I was testing the move from a Jenkins docker image to another using Thinbacvkup and restore the backup and restore went well and of course it didn't bring maven with it (No problem there) I went online and got the latest apache maven bin file (apache-maven-3.8.4-bin), extracted and set up the global tool configuration, export M2_HOME ...ETC. BUT for some reason, it didn't work giving me the same message
searched and searched nothing worked, so I went to the original docker and got the same maven from there (apache-maven-3.5.3-bin)edited the configs and all, and it worked but now I wanted to know why did this work and that won't is there something with my project, build or what?
I actually ended up changing a few things in the maven plugin about 1-2 years ago that fixed a similar issue I had. If you want to try upgrading the maven plugin to 1.2.0 in your build pom.xml that might fix that for you.
Some weeks ago I posted an entry on Publishing to Maven Central with Apache Maven which shows the configuration I put in place on a handful of Open Source projects I maintain. The trigger that starts a release workflow is a commit message with "[release]" as a prefix. I was quite happy with the results, after all I've got the whole release pipeline working on automatic, however two things were nagging me. Firstly that a release workflow would always require a commit. What if I just wanted to publish a release on the go? Add up pushing a release from any branch? Secondly is that while the maven release plugin takes care of setting the release version, tagging, building & publishing, then bumping all POM versions again and committing all changes I just couldn't shake the feeling that something might break during the release and I'll end up with a broken tag. Mind that the release plugin cannot fully rollback a broken release just yet. Also, passing additional arguments to the release build is a bit tricky.
First things first, I've got rid of maven-release plugin, instead I'll use the nexus-staging plugin that bounds to the deploy phase. This means I no longer have automatic versioning & tagging, but I can do that in the workflow itself. Also, moved the nexus-staging plugin to a profile, there's no need to have it configured on every run, particularly as it's run as an extension which adds a few milliseconds on every invocation. Lesson learned, if you don't need a plugin for your main execution then put it in a profile and activate when required; don't waste time executing goals that do not provide value for that particular build invocation. The POM contains the following profile definition
I feel that this workflow setup gives me more fine grained control. The only thing I miss is the automatic version bump that the maven-release plugin performs at the end, however this can easily be solved by manually invoking the maven-versions plugin when needed.
After fumbling around with the configuration a bit more I ended up creating a parent POM project for all my Maven projects. This parent POM defines all the common behavior I want to share on all other projects, and as such it defines the profiles previously mentioned. The project is located at -maven-parent/ and it also defines a manual trigger as explained in this post.
Could not transfer artifact org.apache.maven.reporting:maven-reporting-impl:pom:2.3 from/to google-maven-central ( -download.googleapis.com/maven-central/repos/central/data/): Checksum validation failed, no checksums available -> [Help 1]
and correspond to the options outlined on the WSDL to Java page, you may look at -plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/Option.java for a more detailed description of those parameters.
but it will download maven and then install it.. Since I may need to install maven on a few systems downloading it each time won't be a better option for us. So I am looking forward answer for two questions
Note: these repos are intended for internal ASF project use, not for public distribution of artifacts. Except in the rare situation when a project needs external testing of preproduction artifacts, do not provide download links to 'repository.apache.org' assets to users external to The ASF.
The spring-boot-starter-parent sets the maven.compiler.release property, which restricts the --add-exports, --add-reads, and --patch-module options if they modify system modules.In case you need to use those options, unset maven.compiler.release:
As both the maven-jar-plugin and the spring-boot-maven-plugin runs at the same phase, it is important that the jar plugin is defined first (so that it runs before the repackage goal).Again, if you are using spring-boot-starter-parent, this can be simplified as follows:
Add maven resources to the classpath directly, this allows live in-place editing of resources. Duplicate resources are removed from target/classes to prevent them from appearing twice if ClassLoader.getResources() is called. Please consider adding spring-boot-devtools to your project instead as it provides this feature and many more.
Now try to build the com.vogella.maven.consumer alone by switching into the directory the mvn clean verify command.This fails, as the com.vogella.maven.api project is not available in your local .m2 repo and not part of the build (Maven reactor).
The com.vogella.maven.first project you created earlier does not depend on anything from the other two projects.You can keep its independent build configuration but maybe you want to build if for convenience with the same build.To do this, add it as child module to your build and re-run the build.Ensure it is also build.
If you configure this for the multi project build ensure you modify the correct test.In the exercises it was optional to align the build configuration for the first project you created, so in case you have not updated the pom of com.vogella.maven.first the parent pom setting may not apply for this projet.
Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information. Using maven we can build and manage any Java based project. This tutorial will teach you how to use Maven in your day-to-day life of any project development using Java.
df19127ead