I have a folder that contains some Java code, written specifically for Linux.
There is a pom.xml file and two folders called: src and build
I have installed Eclipse Juno on my Mac (10.7.5) and I understand it already has Maven included. On the Linux machine, the code is executed by entering mvn package at the command line.
But after this stage, during the execution of the build artifact, it doesn't run on my Mac, because some of the commands are specific to Linux (I am told).
How do I import the whole project into Maven on my Mac? I mean where do I copy the folders and pom file?
Thank you,
H
You can leave the maven project where it is. Go to
File->import->Maven->Existing Maven Projects->Root directory
and select the maven project dir.
If you cannot see Maven in Import menu it means you need to add maven plugin (m2e) to your Juno. The fact that mvn runs from command line means only that maven is installed on your PC.
Complementing Evgeniy Dorofeev's answer:
If your project is in a GIT repository and you use eGit, you might want to import it like this:
File->Import->Git->Projects from Git
After the import you can convert your project to a Maven project and it will update the project settings.
Related
I have existing projects that I wrote using Eclipse Juno on another machine, on that machine I downloaded the jars I needed (selenium, jxl, sqlite etc.) from the internet manually and then edited the build path to point to them. I need to move these projects over to a different machine which has Eclipse Kepler loaded. I thought I'd use maven to link everything up (with a view to retro-fitting the machine with Juno to use maven) so that as I jump between the two machines everything will be kept in order automatically.
I installed maven from the marketplace and ran the install:install-file command, but it won't run the program as it insists the jars it's looking for aren't installed (which of course they aren't, that's what I thought maven did).
Is it not possible to use maven in this way (get it to download and link up missing jars) for an existing project? Do I need to do it manually, and if so will I have created problems that I'll have to unpick by having tried this with maven?
If you're using the m2e plugin, you can turn on Maven dependency resolution by just right-clicking on the project and choosing Configure->Convert to Maven project. Make sure your project has a valid pom.xml file and set everything up properly in Preferences->Maven (proxy, user settings, maven installation, ...)
If you're not using m2e, you can use the eclipse maven plugin like this:
mvn eclipse:eclipse
This will call the eclipse goal of the eclipse plugin, and it will generate .project and .classpath files for you with all dependencies pointing to your Maven local repository.
As a side note, the install:install-file goal doesn't have anything to do with what you want to achieve, it's used to install an artifact (a .jar file) to your local Maven repository.
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.
I am importing an existing project into my eclipse workspace. I am using Maven 2.2.0, and Eclipse Juno. I could build project successfully using mvn command prompt.
But unable to import the project as eclipse could not build the project.Eclipse is trying to again download from repository. What If we stop eclipse to download the resources again from repository.
I thought I would add Windows--->Preferences-->Maven--Archetype--Add local catalog
I understood that we have ~/.m2/archetype-catalog.xml catalogu file. But to my surprise I cannot find it.
Please suggest me if I am proceeding with correct way or not.
If its correct way, how do I set local archetype.
Please share your thoughts.
Thanks In Advance.
You need to install the mvn plugin and import the mvn project as such. Alternatively, you can eclipsify the mvn project using the goal eclipse:eclipse (with the mvn command line).
In mvn itself you could set the pluginRepo to updatePolicy NEVER temporarily, if you still have issues with Eclipse. I think Eclipse uses the same settings for importing mvn projects.
http://maven.apache.org/settings.html
I personally never was happy with Eclipse's mvn integration. Have you tried IntelliJ?
I'm new in Maven,Java and Eclipse. I just download a project that uses Maven. I want to know how can import and run this project by Eclipse. I install m2eclipse and work with it but i don't know how can I import a existing project.
You need a maven plugin for Eclipse. m2eclipse or Apache Maven Plugin
This links will help you to import the project. M2eclipse Guideline and Importing maven project into eclipse
Use the Maven Eclipse Plugin. It generates the necessary files for the Eclipse IDE.
For running maven project you will need to install maven plugin in eclipse and than right click on it and select run as maven install
Here is an alternate way without using m2Eclipse plugin.
Install Maven and add the bat file to the path. Once this is done open a command prompt and go to the directory where the pom.xml file of your project exists. At this directory level do a:
mvn eclipse:eclipse
This will make your project Eclipse friendly. Once this is completed, import the project by using File Menu in Eclipse. File->Import. In dialog select Existng Projects into Workspace. Click Next. Then select the root directory as the directory from which you ran the mvn command. Click Finish.
You project should now be in your Eclipse IDE
I'm trying to get the hibernate-sqlite project to work. I downloaded it and can run
mvn eclipse:clean
and
mvn eclipse:eclipse
like the instructions say. And I can import the project into Eclipse. But when I look at the project in Eclipse, it can't find the jars that Maven has downloaded. Where does Maven put the .jars? I don't know where this is, if I knew I could set M2_HOME in eclipse and it would all work.
Linux: /home/<user>/.m2
Windows: C:\Documents and Settings\<user>\.m2
Also, you may want to look into using the m2eclipse plugin if you are doing Maven development with Eclipse.
I found it, maven looks in its settings.xml under
<settings><localRepository>{PathHere}</localRepository></settings>
which if not found, defaults to ~/.m2/repository as Taylor L's answer mentions.