eclipse do not show the setting.xml for maven - i have downloaded luna full package - maven

I am trying to set up maven in new eclipse - i have downloaded eclipse luna full package from eclipse site. but the settings xml for maven needs to be defined .

For the very first time - there are two ways to do this
1- Using Eclipse - embedded settings of maven
2- Using External Maven -
You can follow steps at - Maven in Eclipse: step by step installation
Then you need to create a simple maven project and clean-install it . It wil download all the basic required jars and all the basic plugins required for clean-compile-install operations.
Then you can start creating maven projects using maven archetypes

Related

How to run codes written with maven build in Gradle

if I have created a spring Boot application using maven. Now I have to run the same codes in Gradle,So what all changes I have to make.
Here is the migration guide maven to gradle
A simple project can migrated by following chapter 3
3. Run an automatic conversion
install gradle to you system
run gradle init
Accordig to the same guide:
You’ll find that the new Gradle build includes the following:
All the custom repositories that are specified in the POM
Your external and inter-project dependencies
The appropriate plugins to build the project (limited to one or more of the Maven Publish, Java and War Plugins)

Do we have to include jar files in eclipse project if we are using maven?

I am new to maven.
The POM file in maven contains all the dependencies that we need in our project.
So we don't have to externally add any JAR's to the buildpath in eclipse.Right?
That's right. Maven will download dependencies and M2Eclipse (Eclipse plugin for integrating Eclipse with Maven) will setup a build path for you.
Two Solutions - 1 Using Eclipse IDE
Install the Maven (M2E Eclipse Plugin) if you use older version of eclipse, If you download the latest eclipse.
Point your settings.xml and create a maven project from your eclipse, it is better keep Group Id as com.yourcompany.app Artifact Id as yourProjectName and Version 0.0.1-SNAPSHOT depends on your Architecture Standards set by your company. Also Packaging can be as WAR file for WebApplication, EAR file for Enterprise Application. You can find the numerous list of examples from Maven Site.
2 From Command Line
Install Maven from Apache Maven site, Would recommend to go for the latest version -apache-maven-3.3.9-bin.zip.
Set the Maven Home in the Environment Variables as shown in the below figure.
Edit Your Path variable as %MAVEN_HOME%\bin, verify your installation by using this command from your command prompt. It should display the Maven Home and Java Version, which confirms your maven successful installation.
Paste your settings.xml (C:\apache-maven-3.3.9\conf) given by your build team or Architecture team for accessing your internal repository. And keep a backup of the original settings.xml (which is default download from Maven site)
Run these commands from your command prompt.
mvn eclipse:clean -e
mvn eclipse:eclipse -e (which will automatically set your project build path as shown in the below figure)
It will resolve your compilation issues and your project is ready as an deploy-able artifact

creating different types of projects using eclipse with maven

I know creating the project using maven with command prompt but if i want to import this project into eclipse i have to run some commands and it will be modified suitable for eclipse, My question is can I create different archetype projects using maven plug in to eclipse, without using maven with cmd ?
You can entirely use Eclipse without using the command prompt. Though I prefer to use both terminal and Eclipse interfaces to utilize the maven project, and is a dynamic way of development. Eclipse Mars already include Maven.
Two ways to do this:
Create a new general project, create new POM file, define dependency and build, and Eclipse will recognize to configure as Maven project without applying Eclipse Project facets.
Create a new Maven project, do not skip archetype selection and use quickstart only if creating a simple Java project with main and test source folders, define module properties (group, artifact, version, etc.), and Eclipse will configure project as Maven project without applying Eclipse Project facets.
To execute a clean install, you need to create a goal "clean install" in Eclipse Run Configuration under Maven. Caution, Eclipse use embedded Maven runtime by default so if you'd like to link with your copy of Maven, you'll need to configure Eclipse to point at your Maven installation directory.
Basically, every command you entered in command prompt need to be a goal in Eclipse Maven Run Configuration to separate yourself from using command prompt.
Example Java Maven Project:
Step 1: Create New Maven Project
The first step to begin Maven-enabled Java development without using command prompt.
Step 2: Eclipse Project Configuration
Most of the time, I usually skip this section unless special circumstance requires a working set.
Step 3: Specifying Archetype
Maven archetype quickstart comes with two source package: test and main. This is the most simplest and efficient option to begin Java development. This is equivalent to -DArchetypeArtifactId=maven-archetype-quickstart option.
Step 4: Define Archetype Parameters
Define your own archetype parameters.
Step 5: Confirm Eclipse generated a Maven-enabled Java project
Double check POM and ensure Eclipse throws no error. In this case, Eclipse warns of Java 1.5 not defined. You can fix this by specifying Java version in maven-compiler-plugin within build tag in POM but that's entirely another thread.
Step 6: Define a Maven Goal
We want to test whether Eclipse can do a "mvn clean install" by creating a new run configuration. You can see the console output in background that Eclipse successfully output Maven build.
Is this what you were asking about?

MyEclipse 8.5 creating 'maven-archetype-quickstart' has encountered a prob?

I use the built-in maven of MyEclipse 8.5 to create maven projects.
It shows the following error:
Image is here:pic
Sorry, because I'm new I can't post pictures here yet.
I did it twice on two computers (both are MyEclipse 8.5), but the error was the same.
I use a Eclipse to do the same job and it is successful.
But when using MyEclipse 8.5 to do the job if check "create a simple project (skip archetype selection)" during the process, the project can be created and no error happens, but there is no the folder "Maven Dependencies" in the project created in Package Explorer.
Is this a bug of this version of MyEclipse? Because Eclipse Indigo works fine on this.
If you create a simple project, the folder Maven Dependencies is missing simply because there are no Maven Dependencies in a simple project. Just add a dependency, and the folder Maven Dependencies should be created with your dependency in it.

I have an Eclipse project which is not using Maven, can I start using Maven in a project?

I installed m2eclipse plugin. I want to create pom.xml in my project which is not using maven.
İn this site I found information below about how can I do it but it doesn't work for me.
Create a Maven POM File
If you already have an Eclipse project which is not using Maven, you
can start using Maven in a project by creating a new Maven POM file.
m2eclipse provides a wizard to easily create a new POM file inside an
existing project. To launch this wizard, select File → New → Other...,
type in "maven" in the filter field, and select Maven POM File. This
POM creation wizard is shown in Figure 5, “Creating a New POM”:
Please help me to solve this problem
If you use eclipse indigo then simply right-click the project, select Configure > Convert to maven project. If you are not using eclipse indigo you can do something like right-click project > Maven > Enable dependency management (if I remember correctly)

Resources