Tampilkan postingan dengan label Maven. Tampilkan semua postingan
Tampilkan postingan dengan label Maven. Tampilkan semua postingan

Rabu, 01 Februari 2017

One of the easiest and oldest ways to run a Java program which depends on an external library or framework is to download dependency JAR files, put it on the classpath and then run the program by creating a Main class with the main() method. This is simple but not as easy as you think, there are many challenges down the road e.g. you need to find the right version of JAR files and their dependencies e.g. Spring might have a dependency on other third party libraries like Log4j. So, when the build tool like Maven and Gradle comes, everybody stopped downloading the JAR file manually. All they do is specify the Maven dependency and Maven will download the JAR file of specified version along with their dependencies. This greatly simplified the development and testing of Java application which uses a framework like Spring and Hibernate.
Read more �

Sabtu, 15 Oktober 2016

Even though there are a couple of powerful build and deployment tools exists for Java applications e.g. Gradle or ANT, It seems Maven is the king of them. I have used in several Java projects over the years and it was initially ANT, but now they all use Maven with few Scala projects using Gradle. When you work with Maven you know that there are lots of commands to remember, especially if you are working on the command line. The thee Maven build commands which often confuses Java developers are mvn install, mvn release, and mvn deploy. Many Java developers are never sure which one put the artifact on the remote repository, local repository, and tag the source code in SCM like SVN. In this article, I'll explain the purpose of mvn install, mvn release, and mvn deploy command and some key difference between them.
Read more �

Jumat, 23 September 2016

If you are using Maven inside Eclipse IDE via M2Eclipse plugin then following tips can help you a lot.

1) Setup Dependency as Java Project in Eclipse
If your POM dependencies is another project in Eclipse then your project will automatically get updated whenever you build the dependent project. For example, let's say you have a project, ABC, which is dependent on two core modules e.g. framework.jar and persistence.jar, if you have checked out these project and has set up them as Maven Eclipse project, M2Eclipse can directly add them as dependency, instead of loading their JAR files from repository, be it local or remote.
Read more �

Selasa, 02 Agustus 2016

In the last couple of years, Maven has become the de-facto build tool for Java applications. Though there are challenges exists from tools like Gradle, but I think the dominance of Maven will help it to win the final battle. When I started with Maven, I was happy with just dependency management but then I come to know about maven plugins which let you customize your build up to the level you can do with ANT. These plugins provide true power to Maven to automate most of the build related task e.g. compilation, testing, packaging, deployment, and even committing the source code into the remote source repository. Many Java developers who use Maven daily are usually not aware of these essential Maven plugins mostly because Maven just works, or someone has already done the hard work for them.
Read more �

Minggu, 19 Juni 2016

There is no difference in installing Maven on Windows7, Windows 8, Windows 8.1 or Windows 10, you can follow the same steps to install Maven in any version Windows operating system. Installing Maven is very easy, just download the Apache Maven ZIP file from Apache Maven Project website (https://maven.apache.org/download.cgi). You can download the apache-maven-3.3.9-bin.zip for using Maven in your 64-bit Windows machine. Remember, Maven 3.3 requires JDK 1.7 or above to run, so make sure you already installed JDK 7 or JDK8. Once you download the binary distribution of Maven, half of the job is down. Now, you only need to extract the binary distribution and add the bin folder in PATH or add a couple of environment variable e.g. M2, M2_HOME into your Windows machine.
Read more �

Sabtu, 18 Juni 2016

If you are like many Java developer who uses Maven and Eclipse to build Java project using M2Eclipse plugin, you might have seen this error before. I ran into it recently when I ran the Maven Install command for one of the Java projects, configured as Maen project, only to realize that Maven builds failed after throwing this error. The main reason for this error is that Maven is not able to find javac (the Java compiler) which is required to compile Java source file. If you remember, the javac command comes in the bin directory of JDK, hence, you need a JDK installation in your local machine to compile Java project. You also need to have that configured in Eclipse as Installed JRE. Most likely, you have only installed and set up JRE and not JDK, at least that was the reason it throws "No compiler is provided in this environment" in my machine.

Tools and Environment
JDK 1.8
Eclipse Kepler
M2Eclipse
Apache Maven 3.0.3


I had a Java project configured as Maven project and the following error came when I run the Maven install command

Here is the stack trace :

[ERROR] COMPILATION ERROR :

[INFO] -------------------------------------------------------------

[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

[INFO] 1 error

[INFO] -------------------------------------------------------------

[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

[INFO] ------------------------------------------------------------------------

Later I checked the Installed JRE in Eclipse there was no JDK there. The solution was to configure the JDK 8 installed on my machine.

How to solve Maven Eclipse Error of no JRE or JDK found

You can follow below steps to configure JDK in Eclipse and solve this error:

1) Check if you have JDK configured in Eclipse, you can do by going to Window → Preferences → Java → Installed JRE, as shown in the following diagram:




2) If there is no JDK installed then download the JDK and configure in Eclipse by clicking the add button on same screen as shown below:



3) Change the default JRE of the project to point to JDK. You can do by right click on the project, then go to Java Build path and then click add Library method and choose JRE library as shown below:



I hope following below steps will help you to solve the Maven build related error you are getting while compiling your Maven Java project in Eclipse. If you still face issue then you can let me know by dropping a comment here, or you can also refer a good book like Maven for Eclipse to understand how to setup Maven for Eclipse in the right way and how to use Maven effectively with Eclipse.



That's all about how to solve "No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK" error while using Maven in Eclipse via M2Eclipse plugin. The error message is very accurate in this case as it happened I only had JRE configured in Eclipse. I have configured the installed JDK in Eclipse and set that as my project default JRE and boom, I am managed to build the project using Maven install.

Read more: http://javarevisited.blogspot.com/2016/06/maven-eclipse-error-no-compiler-is-no-JRE-JDK-installed.html#ixzz4oDuMXRPe