When I want to add a library from Maven, I go to Project Settings -> Libraries -> New Project Library -> From Maven... then search for the right library version and tick the JavaDocs checkbox. IntelliJ IDEA will download the library, its Javadocs and its dependencies jar files to the repository folder.
Is there any way to also download its dependencies's Javadocs?
For this to work, you need to add the library to the POM file instead of using the project settings in IntelliJ and make sure that the following setting is checked:
Settings -> Build -> Build Tools -> Maven -> Importing -> Automatically download: Documentation
Related
I used Maven to generate a Jersey project from command line, and I also used mvn eclipse:eclipse so that I can import my project to eclipse.
After I opened the project from Eclipse I see all the jars were in the root folder, how do I create a folder or package so that I can move all these jars into it?
Don't use mvn eclipse:eclipse.
Just do File -> Import -> Maven -> Existing Maven projects and browse the folder where your pom.xml is and Eclipse will organize everything for you.
It looks like you aren't using Maven eclipse integration - m2eclipse. You shouldn't have to install it, it comes already with more recent versions of Eclipse, though follow the instructions in that link if you don't yet have it.
If you just generated the project, try deleting it and then generating it again inside eclipse with New -> Other -> Maven Project. If you have a lot of code written already, instead right click on the project and do Configure -> Convert to Maven Project. Once you've done that, you may have to do Maven -> Update Project project to straighten out your jars, and possibly remove them manually with Build Path -> Configure Build Path.
However, I recommend creating the project from within Eclipse, if possible.
Addendum: #cahen's answer is also correct; don't use mvn eclipse:eclipse.
I'm switching to Intellij and trying to do the same thing as in Eclipse. In Eclipse, you can add a project as a dependency in another project (project properties -> "Java Build Path" -> "Projects" -> Click on my library project).
The current situation is that I'm developing a library and I can test the features in another project without building the jar file every time I add new stuff to the library.
I'm trying to achieve this with Intellij but without success (the projects are both imported in Intellij).
How can I do that?
File > Project Structure. Then choose your module, and add any dependency, either Jar, Library or Module:
Larger image here: http://i.imgur.com/rjdxJHx.png
From File -> project structure, select Modules. You will be presented with all the added projects. Click a project and from the right hand side select Dependencies tab. This will show you projects that are not imported in red coloured text. HTH
File > Project Structure > Project Settings > Modules
Add the module you want to add as dependency.
Add your module dependency in your project.
If you use Maven you'll see the following message:
Module 'your-module' is imported from Maven. Any changes made in its
configuration may be lost after reimporting.
→ Add your project to your pom.xml
If you don't do that, your dependency will be removed each time you reimport/refresh maven projects.
I added this 'org-netbeans-modules-lexer.jar' dependency to a netbeans platform module. But it seems not getting added in the normal way. Imports cannot find its classes as well.
This is how it is shown when added. Any suggestion? Netbeans version 8.0.2
Right click main project properties -> select libraries -> expand 'ide' in platform modules list -> select Lexer module to be included in the project. This resolves the issue.
This method is general for adding any dependencies that can be found only by ticking 'Show Excl. Modules' in dependency adding dialog which can be opened by project module properties -> libraries -> module dependencies -> add dependency.
I encountered NoClassDefFound when my app is running, as I have imported sth form a external jar file. The file is located in /libs and has been added to the java build path. I use Eclipse with android SDK. I have tried clean for many times.
try this.
1. Your Project -> right click -> Properties -> Java Build Path -> Libraries -> Add Jar -> yourjar.jar
2. Your Project -> right click -> Properties -> Java Build Path -> Order & Export --> Select All --> OK
Try adding lib to build path. Right click your lib in eclipse and add to build path.
Or
go to projects properties in eclipse and in java - > java build path -> order and export ,just tick check box on your lib.
Update :: now just uninstall your app from device and clean and build project and run. (clean all projects if you have imported others)..... also build any other library project in eclipse if you have used it in your project.
I'm having this weird problem making my project Maven-based. I created a new Maven project in Eclipse and enabled the Dynamic Web facets. But during runtime now it throws ClassNotFoundException because the Maven dependencies are not copied to WEB-INF/lib directory. I even tried adding the copy-dependencies section in POM, but it didn't help.
Someone here seemed to have solved this the right way, but I guess he forgot to mention the solution ::(
This should have nothing to do with eclipse and m2eclipse, and optionally for better support - m2e-wtp. Also, you don't need copy-dependencies. Here are a few possible reasons:
you should invoke mvn package (or right-click > maven > package) and obtain a war file - the <packaging> (in the pom) must be war
your dependencies should be with the default scope (if they are provided or test they will not be included in the archive)
if you are running the project as dynamic web project on a server within eclipse, then you should open the project properties (right click > properties) and select "Deployment Assembly". There click "add", select "build path entries", and choose "maven dependencies". This will instruct WTP to send the maven dependencies to the server dir.
First install Maven Integration For Eclipse WTP (Help->Eclipse Marketplace)
Then in your web project's pom.xml just add:
<packaging>war</packaging>
After that just right click the project, Maven -> Update Project, which should automagically add Maven Dependencies for you in the Deployment Assembly.
Right-click project > Maven > Update Maven Project > OK fixed it for me
Check the Deployment Assembly property of the project. I have seen some mvn eclipse:eclipse generated Eclipse projects sometimes have the assets being deployed to the wrong location. From what I can remember the new Deployment Assembly had some issues with earlier versions of Eclipse 3.6 (Helios).
I just did maven -> update project worked for me.
On Eclipse, select your Web Project -> right click -> Properties -> Deployment Assembly -> Add -> Java Build Path Entries -> Maven Dependencies
With this steps, maven libraries will be included on WEB-INF/lib when full publish.
you want to use the copy-dependencies plugin
see this post and the docs
If you look into your deployment and see that WEB-Inf/lib is empty of your Maven dependencies, then ensuring those Maven dependencies are in your deployment assembly is crucial as mention in the chosen answer.
However be wary of Eclipse then not refreshing everything even with a Maven update. If you clean, rebuild and redeploy and still do not see the lib folder being populated try removing and re-adding the application to the server deployments via Servers>Add and Remove.
This unclogged the system for me.
Right-click project -> Deployment Assembly:
See if you have the Maven Dependencies and all others in there.
If not,
Right-Click project -> Maven -> Enable Workspace Resolution
(maybe then Maven -> Update Project, but then look again into "Deployment Assembly" and see what You've got.)
this solved it (finally!) for me.