I don't know what's the problem but I am not able to use a maven for my projects.
This is the output of the command that means all the setup for maven is done properly but dont know why performing tasks is leading to a BUILD FAILURE.
mvn.cmd
mvn clean
You are in your main user folder vipul. The clean command is project specific, you need to be in the project path, a project which is configured for maven (has pom.xml file)
The error says you don't have a pom.xml file, which means you're running the command in the wrong directory or you haven't got the project set up. This quick Maven overview guide will help you set up a project if you haven't already.
Related
I use eclipse and I want to compile and run this code from gitub https://github.com/openphacts/Validator ,it needs maven project to build it but unfortunately I don't know how to proceed with it. Can someone help me how to get this project into eclipse to run it and test it in my machine please? It's emergency
Once you've checked out the project from github, you need to utilize maven to install the dependencies and build the project. In the root folder of the project (where the pom.xml is located), enter the following in your command line:
mvn install
More details can be found here: https://maven.apache.org/run-maven/
Additionally, you must first download the maven command line tool: https://maven.apache.org/download.cgi
And install it: https://maven.apache.org/install.html
I am just starting out with Maven. Is there any way to get maven dependencies to be added to the Eclipse project's build path? As of right now, my project is full of red x's due to Eclipse not being able to include some external class from one of these dependencies.
First you need to setup you M2_REPO variable. This is a class path variable that tells eclipse where your designated maven repository is located.
You can setup M2_REPO by running the following command in your workspace.
mvn -Declipse.workspace="replace with your Eclipse Workspace" eclipse:configure-workspace
Next make sure that your project has a maven fact applied by running the following command
mvn eclipse:eclipse
in the workspace of your project. run
mvn clean package
just for good measure to make sure all your dependencies are resolved and available before restarting eclipse.
Once you restart eclipse again and bring your project up your issues should be resolved.
You should look up more information about these 2 commands and how to use them effectively.
Save yourself a ton of hassle and get the M2Eclipse plugin. The plugin will handle all of the project setup for you and you don't have to worry about doing the mvn eclipse:eclipse commands.
http://www.sonatype.org/m2eclipse/
have you executed
mvn eclipse:configure-workspace -Declipse.workspace=/path/to/workspace
?
You need to execute it so maven set the M2_REPO path to eclipse. Or you can set it manually.
Remenber to restart eclipse after you do so :P
I have two maven projects and both are working fine independently. I am able to create a jar file and run it from console as well as from eclipse.
I copied over some classes from the second project into the first and made a few changes so that it runs as a single project with features from both.
I have two pom files, so I combined them into a single pom file.
The thing is that I am able to run it from eclipse fine and able to get the output I was hoping for.
But I am not able to run it after executing the jar file created from "mvn package".
I am using shade maven plugin.
If I use maven build.. with clean install as goal, it again showing errors.
My question is this, why this discrepancy?
We would need more information to correctly diagnose the issue. One thing to look at is to ensure that any changes to dependencies which are projects in Eclipse have been installed as a command line build will only look in your repo, not at your Eclipse project.
This may happen when you have a dependency which exists as an open project in your eclipse workspace.
Try closing every project except the one where you're having this problem. Does it still compile in eclipse then?
I want to build my project with Maven. How do I do that?
Maven is installed,
the project is called Sertsu1
it contains a pom.xml-file
What must be entered in the command line to start building?
If your project is organized as Maven expects, e.g. your source code is in the src\main\java directory you can run
mvn package
to just build your jar
mvn install
to install it in your local Maven repository
mvn clean
to remove a previous build
Beware that you won't go very far with Maven without reading about it. You can start with this book.
In order to create an artifact (jar-file) you need to invoke
mvn package
This is very basic and you should take your time to read the suggested manuals before using maven.
Navigate to the folder that contains the pom.xml and enter
mvn package
(for a quick result)
Your machine needs to be connected to the internet as maven will download a lot of files from public repositories.
This sample app ("thoughtsite") for App Engine contains a pom.xml in its trunk:
http://code.google.com/p/thoughtsite/source/browse/#svn/trunk
But I don't know what command to run in Maven to set up the project locally. (The README doesn't mention anything about Maven.)
I tried to just import the project code directly into Eclipse but it doesn't look like it's in an appropriate format for a direct import. So I assume I need to do something with Maven to get it set up correctly. I haven't really used Maven before so I'm not sure what command I would need to run to set everything up. The pom.xml seems like it downloads a bunch of dependencies for the project like the Spring jar files which I don't see anywhere else in the svn repository.
First you need to install maven. (Download it, put it somewhere and set the environment variables JAVA_HOME and MAVEN_HOME). Here are some more Installation instructions.
Then either a) install m2eclipse and then import the project using "import existing maven project" you should be up and running.
or, b) on the command line, run mvn eclipse:eclipse from inside the project directory and then just import the project as an existing eclipse project
I prefer m2eclipse because it makes eclipse maven-savvy, but many others prefer to just tell eclipse where stuff is from the outside using the command line