I updated the pom.xml to spring 3.0.1.RELEASE instead of Spring 2.x.x .
So when I did 'mvn clean install', the lib directory in my target directory was correctly updated with the right jar files.
But when I do a right click on my project and then go to "Build Path", I notice that I have the old dependencies of spring and not the dependencies for spring 3.0.
How can I update the Java Build Path?
If this is eclipse (you are using), then you need to update the Eclipse project file from the .pom file. That is done by doing the following command:
mvn eclipse:eclipse
After that, refresh project in eclipse and you will see that eclipse recognises the dependencies from the pom file.
Related
I am trying to add the Maven dependencies of a Maven project into a non-Maven project. However, there are too many and adding them one by one would be too tedious. Could someone suggest a shortcut to add them all at once?
What do you mean by adding dependencies to a non-maven project?
If you want to make it a maven project, right-click the project and in configure click convert to maven project. Otherwise, you can copy-past the jars into your build path. If you have the other maven project in your computer, you can locate the jars in .m2 folder in your user directory and add them to the project or download them one by one.
Run the following maven command in the main directory of your maven project:
mvn dependency:copy-dependencies
Then you will be able to find all of the downloaded jar files of your dependencies here:
{PROJECT-MAIN-DIRECTORY}/target/dependency/
You can add the -DoutputDirectory parameter to have the jar files placed somewhere else.
Afterwards you may simply add the jars to the build path of your non-maven project.
I am trying to build a spring-mvc project that has another project (core, as .jar) as dependency.
If I disable "Resolve dependencies from workspace projects" in eclipse, install the core into my maven repo and run it from eclipse, the application works!
What I want to do, is re enable "Resolve dependencies from workspace projects", but there is the problem: When I try to run the project on tomcat (after maven clean, project clean), I get a "FileNotFoundException". The file in question is under src/main/resources/META-INF/spring/applicationContext-core.xml
It seems, the File can not be found in the classpath.
I looked up the deployment location and found out, that everything of the core is under the following folders:
WEB-INF
classes
So the file I am missing can be found here:
/WEB-INF/classes/META-INF/spring/applicationContext-core.xml
But it schould be here:
/META-INF/spring/applicationContext-core.xml
Why is the structure of my core dependency so messed up when I enable the workspace resolution and how can I fix this?
I am using eclipse mars with m2e..
Thanks for any help.
Edit:
Project structure (core) looks like this:
project structure
I am working with Eclipse Luna.
I have a dynamic web project into my workspace: project-web. This project depends on another project into my workspace: project-lib.
So I get this scenario: project-web[:war] ---depends on--> project-lib[:jar]
I have checked "Resolve dependences from workspace projects" option into Properties -> Maven for the web project.
When I run "mvn clean package" for project-web Maven creates war file into the target directory but I have
an issue. If I explode the war file, I find an empty folder called "project-lib" into the WEB-INF/lib directory.
Since the library is empty I get some java exceptions on Tomcat startup.
How to create the war for project-web correctly?
Thanks in advance.
Enrico
I am working with my first Maven project in Eclipse. I want Maven to build (run configuration is of type Maven Build) my jar file and everything additional to ${project.basedir}/build. I configure my pom.xml as follows.
<build>
<directory>${project.basedir}/build</directory>
Now I have the problem that when I want to Run (not build, so the run configuration is of type Java Application) then the ${project.basedir}/build directory is being used as current working path.
How to I separate directories for build and run in Maven (Eclipse Plug-in)?
I am using eclipse for my project development. In my pom.xml no where I have added dependency for Jetty jars (jetty-server, jetty-io, jetty-http, ...). But when I run "mvn package" command in my local repository and in my WEB-INF --> lib folder these jetty jars are getting added. But I don't want to use those jars. Can someone please suggest me a way to delete these jars through pom.xml.
In my local repository its getting added in repository --> org --> eclipse --> jetty. I tried to delete it by making use of tag in pom.xml, but couldn't resolve.
type mvn dependency:tree in console. You will see where from those jars are
You can try to run your maven project from Console with the command mvn clean package inside the folder that you have your pom.xml file. With this command you clean your application. Maybe this can remove these libraries