I recently did a pull on the local repository. I ran into some missing dependencies, nothing unusual there. I ran mvn clean -U install on the projects concerned, no problem, everything looks good in maven on the command line. I refresh my projects in eclipse, no joy, eclipse says I'm missing dependencies.
After a bit of messing around back and forth with no success, I looked in the local repository itself. Sure enough, many of the required dependencies are missing; they are however, located in the target folder.
I've tried building with install a number of times, but the jars aren't placed in the local repository, so my other projects can't find them.
Sometimes a later version of the library is there, but not an earlier on, for example 6.0.28-SNAPSHOT is there but not 6.0.27-SNAPSHOT.
I have checked my settings in eclipse and maven:
Eclipse is using the correct version of maven
They both have the same local repository
They are both using the same settings.xml file
They are both using the same version of Java
Since all the jars I checked appear to be in the target folder, I think the issue is with maven not installing them into the local repository. What could cause this issue, and how can i resolve it?
Also, although I don't think this is relevant myself, as everything has been working fine before, my target directory is a completely separate folder, and is not a sub-folder of each project. It's located in C:\Maven\target.
I forgot to run:
mvn eclipse:eclipse
After pulling the updates from git.
Related
I'm trying to use SQLcl in my maven Java project, but I cannot figure out how to use it.
What I have tried so far:
I downloaded the latest SQLcl (sqlcl-19.4.0.354.0937.zip) from oracle.
I extracted all the files into a local folder. I then opened the sqlcl-19.4.0.354.0937\sqlcl\lib folder with terminal and ran 'mvn validate'. Maven stated that 'ucp.jar' is missing. I downloaded that jar from oracle downloads and ran it again. This time it 'seemed to run successfully'. I also tried to 'mvn clean install' with same results.
However, I'm unable to find 'dbtools-common.jar', 'dbtools-http.jar' or 'dbtools-sqlcl.jar' files anywhere in my m2 folder. This tutorial was explaining to do it like this. Intellij is unable to import classes like 'ScriptParser' because the dependencies are missing.
What's the correct way to do this?
The pom sqlcl/lib is used for installing dependent jars into your local repository. However, its not for installing the sqlcl jars (dbtools-*) into your local repository.
You can certainly tweak it to do so, and use them as #Hooman.AS suggests.
The pom is to load the dependencies for the jdbcrest so that users can try out the rest jdbc driver.
explored all solutions to this, including clearing out metadata folder and making sure the compiler matches the project version. I also have build automatically checked.
When I save my files in eclipse they update in the filesystem, but when I attempt to run my maven project and deploy it to the JBoss server it runs and old version.
I've even put in compiler errors on purpose and it doesn't bother it at all.
Please try building your project with a clean command
mvn clean install
and also refresh your workspace in eclispe. Might help!
do maven clean install through eclipse maven plugin, to avoid different code base confusion, it seems you are editing some different code base on eclipse which is different when you build through maven.
recheck the path for both the cases.
At the end copy the jar from the eclipse project itself after refresh the project on eclipse.
I faced the same issue, due to eclipse was not loading the new jar, caching the old one. it's required to refresh the project on eclipse before taking the build jar.
I work behind a very massive firewall that likes to hiccup on random connections, which makes all work with remote repositories a living nightmare for me!
I am looking to work with a project from Git (this one https://github.com/mrniko/netty-socketio) which heavily utilizes maven for downloading dependencies.
What I would like to do is on another terminal (such as http://cloud9.io or something) download all the maven dependencies so that the entire project can be run standalone.
I have already tried mvn clean install and then zipping up the source folder, but its actually not enough! I still get ClassNotFound related errors when I try to run the project locally in eclipse. And for the record, I did add the compiled *.class files in the build properties, so Eclipse knows where they are. It seems like there are some random classes that get generated dynamically which still aren't present (such as log4j -- and I really don't want to hunt each one down individually)
I am wondering if there is a fully thorough way to download all possible dependencies from maven and then either run a project 100% standalone, or create a local maven server from it?
I am running Java 7 on Eclipse Luna and I do have Maven installed on my windows 7 machine (though again it barely works on remote repositories). I also have a Cloud9 instance which I could use to run Maven commands, then zip up the results for local download.
When you execute mvn clean install, maven downloads all dependencies of currently built project to your local maven repository. This is usually located in
%USERPROFILE%\.m2\repository
When you build your project, maven uses that path, to lookup required dependencies.
If you want do download them all, you can try using mvn dependency:copy-dependencies. Then, you'll find all project dependencies intarget/dependencies directory of your project. This also includes transitive dependencies.
To add them all as eclipse dependencies, you may want to try maven-eclipse-plugin. Using that plugin, you can generate eclipse .project and .classpath files, using mvn eclipse:eclipse command. This will populate eclipse files with required dependencies from maven. You should then import the project to eclipse using Import existing projects into workspace, instead of Import existing maven projects.
maven-eclipse-plugin will add all those jars relative to a folder specified by M2_REPO variable. Just make sure you edit this variable inside eclipse project properties, and you should be set.
I've had to deal with similar issues. I would find that due to changes in firewall policies, occasionally all the .jar files in my project had been updated to be a 1K file that, when opened within notepad++ contained a message from the firewall saying that the download had been blocked.
I recommend looking into Nexus for your local repository management, it means your local projects don't have to go past your firewalls to check for maven updates.
http://www.andrejkoelewijn.com/blog/2010/03/09/getting-started-with-nexus-maven-repository-manager/
Use dependency plugin go-offline task.
I am trying to build a web application based on the project library CitySDK, but i don't know how to import it properly into my own project.
I have created a Maven Web Application and added the CitySDK library as a Dependency, and then Selected the Project, right-clicked and Selected Build with Dependencies. No errors appeared, and in the image below you can see it appeared as a dependency.
However, whenever i try to use some of the classes specific to it, in my own Web Application(called TourismApplication's TestClass.java), the compiler displays an error, that the package is unknown. Could anyone suggest ideas as to what i have missed? I have followed a few Maven tutorials, but without any effects.
The dependencies are as follows:
Ok I did some digging and I think I figured out your problem. Their POM file is incorrect based on the structure of project.
First off, I'll paraphrase what I think the steps you took to get it built in your project were, to ensure I followed the same steps to get it working. These are the steps I took:
Cloned/downloaded the sources from the link you placed in the OP
Built the project into a jar file by running the command they said to use: mvn clean package assembly:single
Installed the artifact in your local Maven repo using mvn install
Added a dependency in your project POM
I tried the same thing you did, using the library in a test source file, to no avail. I looked at the .jar file that was built using their instructions and didn't find any .class files archived into it... it was essentially empty.
Turns out, their src folder structure follows Maven standards, but their POM file indicates the sources are down a different chain of directories. If you examine the build log closely, you see "[INFO] No sources to compile"
The POM.xml file they provide specifies the source directory as
<sourceDirectory>src/citysdk/tourism/client</sourceDirectory>
However, the actual files are at
src\main\java\citysdk\tourism\client
After changing the line in the POM file from the above to (similarly for tests):
<sourceDirectory>src/main/java/citysdk/tourism/client</sourceDirectory>
<testSourceDirectory>src/test/java/citysdk/tourism/client/tests</testSourceDirectory>
rebuilt, and installed, it worked when I tried to use it in my project. Hope this helps.
FYI, I used IntelliJ as my IDE, but it should work the same with Eclipse.
In my Java project, which has a maven 'nature', m2e version 1.0.10020110804 does NOT detect any jars located in my local repo. I can successfully compile/install using maven from the command line, but when I open the project in Eclipse I'm notified of 100+ (cannot be resolved to a type) errors. Does anyone know how to resolve this problem? I've tried updating dependencies and cleaning my project, but neither works. My local repo is set in m2e under 'User Settings'.
M2e needs to be configured to use your local , home repository . In general, one would expect it to do so automatically... But in your case, its using a different home repository.
I feel your pain here - I have seen it use a default repo inside of eclipse in some cases, which can cause problems if you have / need your own local .m2 directory.
I believe that when I first got this problem, I was installing the m2e plugin without having installed first setting maven up as a standalone application. In this case, it might be that the m2e plugin uses a local maven copy/repo .
So the moral of the story is : You need to configure the plugin to "see" and "use" your M2_HOME correctly.
There are some good tips on getting the settings right here : Eclipse m2eclipse getting dependancies from local repository
By editing the m2e plugin settings through the Preferences window, you can ensure that m2e is accessing the right Maven HOME directory, and that will solve this problem.
I recently faced the same problem. The root cause was that I imported my project as a generic project and later added maven and java natures to it. I resolved the issue by closing and removing the project from my workspace and re-importing as a maven project and then syncing it with my local repo. HTH.
did you try refreshing the workspace?
I am having a similar experience, and I've tried all those thing because it wasn't recognizing the Rhino jar in my unit tests. A lot less errors, but still a couple. Had to close the project, close eclipse, run mvn clean compile, open eclipse, open the project.