IntelliJ - maven project, View/Tool Windows without maven option - java

I use IntelliJ IDEA Community 2020.1. I have generated a maven project structure from the command line using a custom archetype. I open that project in IntelliJ this way: File/New/Project from Existing Sources/Create project from existing source. A project is opened but I don't see a maven option in View/Tool Windows. I would like to run mvn install from IDE. What I'm doing wrong ?

You need to add the Maven support for the project that you have created.
Simply right-click on the project --> Add Framework Support --> Choose maven from the option.
For detail, you can follow the steps mentioned here Add maven support.

Related

IntelliJ IDEA : support both SBT and Maven on a single project

I already have a project in IntelliJ IDEA based on SBT. It works fine, compile and run. Now I want to add the Maven support as well.
How is it possible in IntelliJ IDEA having support for both build managers SBT and Maven in the same project and switch between them ?
In my experience you should have either maven or sbt enabled. Never both.
The solution:
checkout project from repository to project_sbt directory
open project in intellij as sbt project (just open project_sbt/build.sbt from disk)
checkout the same project from repository project to project_maven directory.
open project in intellij as maven project (just open project_maven/pom.xml from disk)
Disadvantages of this solution:
Changes in sbt project are not visible immediately in maven project (and vice versa)
You have to maintenance two build systems (special plugins)

How to use command prompt in eclipse to create Maven Project?

I am new to the Maven, Vaadin, Eclipse Kelper. I am working on project which include Maven, Vaadin.
I don't know how to create maven project using command prompt. I tried using Vaadin.com website, but not found the proper steps.
you install maven plugin for eclipse. And then you will have facility to create maven projects in eclipse with GUI.
Follow this tutorial: https://vaadin.com/wiki/-/wiki/Main/Using+Vaadin+with+Maven
After that in eclipse you can import the project as existing maven project.

How to use Maven with EAR

If i want to convert an EAR project a maven project , do i need to add the module in the deployment assembly as maven dependency or just use the convert in m2eclipse without any further configuration.
Me personally I wouldn't attempt any kind of conversion of an existing project. I would add the poms, make sure that mvn clean install works on the command prompt and then create a new mavenized Eclipse project from the poms.
The main reason is that you current project settings are effectively wrong when you switch to Maven - the Maven poms are the truth and what feeds the Eclipse project setup, so you really do not want to make your life difficult and work against m2eclipse - let it do the project creation for you. Fresh.
You can install m2eclipse and then do the following as well.
Go to the project menu (right click on Package Explorer) > Configure > Convert to Maven Project
Open the pom.xml and right-click and choose Run As -> Maven Clean. Similarly Choose Run As -> Maven Install.
Note : Please ensure that your eclipse project settings are correct and classpath libraries are not absolute and you don't have any project specific environment variables defined in your workspace. Please take a backup of your project before you do this.This is to ensure we don't mess up the current stable project configurations. Once m2eclipse generates the pom.xml for your project, you can update and make changes to it to
fully obtain a mavenized ear build. hope this helps
You can also try creating new maven project with archetype selection of "jboss-javaee6-ear" and follow the similar structure for your project. Most probably you will need parent Pom and child poms per each module (ejb, war, jar etc). There are other few similar approach but almost all of them requires you to have mulitple POMs
maven-ear-plugin and JBoss AS 7
You can also go through all the examples for maven ear plugin to find settings suitable for you
http://maven.apache.org/plugins/maven-ear-plugin/
I ended up ditching ear for war :) single POM and even ditched the JBOss for tomcat/jetty :)
If you want to convert your existing eclipse dependencies into Maven dependencies, you can try the JBoss Tools (JBT) Maven integration feature, which contains an experimental conversion wizard, plugged into m2e's conversion process : http://docs.jboss.org/tools/whatsnew/maven/maven-news-4.0.0.Beta1.html.
So, all you have to do is, as Keerthi explained, right-click on your project and Configure > Convert to Maven...
If your dependencies already are maven artifacts, it should work easily. If not, you'll need to convert them to Maven (if they're workspace projects) or make them available in your maven enterprise repository, before converting the EAR project.
JBT (requires Eclipse JavaEE) can be installed from http://download.jboss.org/jbosstools/updates/stable/kepler/ or from the Eclipse Marketplace (See https://marketplace.eclipse.org/search/site/jboss%2520tools)

How to make git project as Android Project?

I receive projects from github.
They are android project. But they does not have android.jar, project.properties, ...
How can I use them as Android Project?
This is an android-maven project.
I think there are two ways:
First
You'll need to download MAVEN and Install it.
Once completed, go to the command line. Check that maven is working by typing..
mvn --version
Once you get it working, with the command line, navigate to the project directory (where the pom.xml file is located) and type..
mvn clean install
This should generate the necessary files.
Second
Download the m2eclipse (Maven to Eclipse) eclipse plugin.
Once installed, go to:
File -> Import -> Maven -> Existing Maven Projects -> Choose the project folder
If you're using Android Studio, there is also an option available to import maven projects.
Personally, I prefer the first method... but it's up to you :)
2 options:
Ask them to Create a new project from existing source.
Push your .project file to github, and eclipse should be able to setup the android project correctly.

How to create the pom.xml for a Java project with Eclipse

I already have a small Java project. I want to move it to Maven, so I want to create the pom.xml using Eclipse so that I can build it using pom from a command prompt. I have not worked with Maven before, though I have worked with Ant.
How can I create the pom.xml for my Java project using Eclipse?
You should use the new available m2e plugin for Maven integration in Eclipse. With help of that plugin, you should create a new project and move your sources into that project. These are the steps:
Check if m2e (or the former m2eclipse) are installed in your Eclipse distribution. If not, install it.
Open the "New Project Wizard": File > New > Project...
Open Maven and select Maven Project and click Next.
Select Create a simple project (to skip the archetype selection).
Add the necessary information: Group Id, Artifact Id, Packaging == jar, and a Name.
Finish the Wizard.
Your new Maven project is now generated, and you are able to move your sources and test packages to the relevant location in your workspace.
After that, you can build your project (inside Eclipse) by selecting your project, then calling from the context menu Run as > Maven install.
This works for me on Mac:
Right click on the project, select Configure → Convert to Maven Project.
If you have plugin for Maven in Eclipse, you can do following:
right click on your project -> Maven -> Enable Dependency Management
This will convert your project to Maven and creates a pom.xml. Fast and simple...
To create POM.XML file in Eclipse:
Install M2E plugin (http://www.eclipse.org/m2e/)
Right click on project -> Configure -> Convert to Maven Project
The easiest way would be to create a new (simple) Maven project using the "new project" wizard. You can then migrate your source into the Maven folder structure + the auto generated POM file.
To create pom.xml file follow the next steps:
Right click on the current project
Select Configure option
Select Convert to Maven Project
Complete all fields in Create new POM window
Check "Delete original references from project"
Click on Finish button
If eclipse show the the error "Maven error “Failure to transfer…", follow the next steps
Copy the dependency to pom.
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-archiver</artifactId>
<version>2.5</version>
</dependency>
Click right on your project
Select Maven
Select Update project
Select Force Update of Snapshots/Releases
Right click on Project -> Add FrameWork Support -> Maven

Categories

Resources