0

CentOS 7, Java 8

I was to build my java project with specific Maven version = 2.2.1 So to do this I use maven wrapper. Doc here

In terminal I run the next command in my Java project's folder:

mvn -N io.takari:maven:0.7.7:wrapper -Dmaven=2.2.1

After executing the goal, we'll have more files and directories in the project:

1. mvnw: it's an executable Unix shell script used in place of a fully installed Maven
2. mvnw.cmd: it's the Batch version of the above script
3. .mvn: the hidden folder that holds the Maven Wrapper Java library and its properties file
4. In my home folder I has the next folder:
/home/my_user/.m2/wrapper/dists/apache-maven-2.2.1-bin/4t5e722kpe8tvsedcs0947snl3/apache-maven-2.2.1

After that, I run our goals like this for the Unix system:

./mvnw clean install

But I get error:

Exception in thread "main" java.lang.RuntimeException: Could not locate the Maven launcher JAR in Maven distribution '/home/my_user/.m2/wrapper/dists/apache-maven-2.2.1-bin/4t5e722kpe8tvsedcs0947snl3/apache-maven-2.2.1'.
    at org.apache.maven.wrapper.BootstrapMainStarter.findLauncherJar(BootstrapMainStarter.java:50)
    at org.apache.maven.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:28)
    at org.apache.maven.wrapper.WrapperExecutor.execute(WrapperExecutor.java:122)
    at org.apache.maven.wrapper.MavenWrapperMain.main(MavenWrapperMain.java:61)
Alexei
  • 14,350
  • 37
  • 121
  • 240
  • Can you please explain why using Maven 2.X and not Maven 3? [Maven 2 is End Of Life](https://maven.apache.org/docs/history.html#maven-2) – khmarbaise May 15 '21 at 12:23
  • @khmarbaise Because I try to build very old project than build only on Maven 2.x – Alexei May 15 '21 at 12:27
  • Does not really matter upgrade to Maven 3 (most recent) and build that project ... also I expect you need to upgrade plugins) ...and building on Maven 2 only I have my doubts......If you need to build that old project you should do some maintenance on it...in particular if you want to work with JDK 8... – khmarbaise May 15 '21 at 12:29
  • @khmarbaise The project is very big and compile only by Java 8. If I try to build by Maven 3 , the build is failed. – Alexei May 15 '21 at 12:32
  • If it's it's even more important to migrate to up-to-date software... and the question why does it fail ? what are the issues? – khmarbaise May 15 '21 at 12:39
  • @khmarbaise Is not possible to migrate. Source code is not access. – Alexei May 15 '21 at 13:21

0 Answers0