Maven: Convert non maven projects to maven project

  1. Right click on the project-> Add Framework Support

Add external dependencies

Add Java 1.8

<build>
<plugins>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>

<source>1.8</source>
<target>1.8</target>

</configuration>

</plugin>
</plugins>
</build>

Now add the JUnit4

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>

How to add a Jar which is not available in Maven central repo?

<dependency>
<!--FIXME: add this jar in Nexus and use from there-->
<groupId>give-any-name</groupId>
<artifactId>give-any-name</artifactId>
<version>give-any-version</version>
<scope>system</scope>
<systemPath>${basedir}/lib/name-of-the-jar.jar</systemPath>
</dependency>

Reload

Compile

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store