I have mvn web application project. I run
mvn clean install
mvn eclipse:eclipse
in target{project-name}\WEB-INF\lib dictonary, here is all jar files (amount of all jar is 77), that I have declared in pom.xml.
I have created new server in eclipse .
add priject to server.
when I open servers project lib dictonary path\apache-tomcat-8.0.14\webapps{project-name}\WEB-INF\lib
I found all jar files, except one (amount of all jar is 76).
why this happens?
I do not have this jar file:
<dependency>
<groupId>org.lazyluke</groupId>
<artifactId>log4jdbc-remix</artifactId>
<version>0.2.7</version>
</dependency>
The same happens , for example, when I add another jars in pom.xml. I do not understand why eclipse does not copy all the jars...
Eclipse version: Luna
Tomcat version: 8.0.14
There are issues with eclipse-maven synchronization. If pom is changed this doesn't get synchronized with webapps already deployed on the Tomcat. So you need to do
Tomcat>Clean...
This will do the sync. Also make sure maven dependencies are added in
Project>Properties>Deployment Assesmbly
Related
I am using Eclipse m2e plugin to import existing web app to Eclipse. And Tomcat is used to deploy the web app. I run the Tomcat from Eclipse' Servers list.
And everything works fine except when I got ClassNotFoundException when I tried to Run the project on Tomcat Server. The not found class is a class from another m2e project which is depended by the web app project.
And I navigated into the web app deployment folder like
$EclipseWorkspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/MyApp/WEB-INF/lib
and found out the jar containing complained not found class was indeed generated in WEB-INF/lib. But the jar was in weird layout.
The layout was like below
src/main/java/com/mycompany/xxx.java
target/classes/com/mycompany/xxx.class
but not expected
com/mycompany/xxx.class
I looked into the Deployment Assembly section of the web app properties, everything was fine.
Why the Eclipse(or the m2e plugin) generates wrong formatted JAR files?
I was using maven Eclipse plugin to generate .classpath, .project files and .settings/ folder for Eclipse, via
mvn eclipse:eclipse
.
I didn't clean all these Eclipse
.classpath file
.project file
.wtpmodules file
.setting folder
before I used Eclipse m2e plugin.
At the end I deleted all these
.classpath file
.project file
.wtpmodules file
.setting folder
.
And re-import all the maven projects to Eclipse using m2e plugin.
Then the issue I mentioned was gone! All jars are now in good shape!
Looks like the existing Eclipse files causes the m2e plugin not happy, and generated unexpected result.
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 would like to have all the JAR files of Maven in my hard-drive to do some experiments. Is there any way to download all the jar files from Maven repository?
My operating system that i used is Windows 7.
It is not clear what you mean by "all the JAR files of Maven", the Maven central repository contains gigs of jar files. If you can explain further what you are trying to do then it will be easier to help.
If you have a maven project then you can run:
mvn clean install
from the directory where the pom.xml file is located. Maven will download all of the dependencies required by the project to your computer, the default location is the .m2 directory under your user directory.
Another option is to use the maven dependency plugin to download all of the dependencies of a given project to a location.
Use a repository manager like Nexus. http://nexus.sonatype.org/
or Apache Archiva too http://archiva.apache.org/ :-)
See http://docs.codehaus.org/display/MAVENUSER/Maven+Repository+Manager+Feature+Matrix
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
I had a perfectly running Eclipse project with Maven and project dependencies. Now I want to switch to IntelliJ IDEA - the import of my projects worked nicely (now called module with Maven and module dependencies), all the Maven configuration seemed to work out of the box (can expand libs and see source code).
When I run my module I get:
Exception in thread "main" java.lang.NoClassDefFoundError: com/thoughtworks/xstream/XStream
From a dependent module, xstream-1.4.2.jar is correctly in the build path of that module.
What I tried and did not work:
Importing projects as Eclipse projects, applying Maven nature/framework support afterwards
Importing projects as Maven projects
Invalidate caches
Maven Reimport & Generate Sources and Update Folders
What worked but is not a solution: I can add the xstream-1.4.2.jar to the dependencies of the module I am running, but then it fails with the next missing jar. So it seems as if it does not find the jars referenced in referenced modules.
Often one encounters the NoClassDefFoundError when there are two libs in different versions on the classpath - I double checked, there is only one xstream*.jar file there.
I appreciate any help.
Thank you, Marcel
Is xstream-1.4.2.jar located in the correct groupid/artificatid/1.4.2/ folder under .m2 repository?
If you are running on linux, .m2 will be located under /home//.m2
If you are running on Windows, .m2 folder will be located under C:\Users\.m2