Intellij cannot find Derby jars - intellij-idea

As I checked out this project from Git with Intellij it seemed not to be able to resolve where the Derby jars were for it couldn't import the class org.apache.derby.drda.NetworkServerControl. You can see the picture bellow in which the right side is the one at issue and the jars don't have the navigating triangles to open up the classes. So how should I resolve this problem?

First you need to add this jar to your classpath. You can it in two ways:
Add Derby dependency to your project from Maven repository.
Derby DB is already included in the Java Development Kit (typically /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/db/lib/derby.jar). Open your Project Structure (command+;) and add it as a library to your project:
Now it is available under External libraries in the Project View (command+1):

Related

Intellij IDEA With Multiple Gradle Projects

I am working on two Gradle projects. One of these projects is a supporting library that will be used by other projects in the future so project A depends on project B but not as a 'multi module project'. The dependency is to be resolved through the artifact repo so project a declares it as a compile dependency using it's maven coordinates.
My problem is when working on these two projects in IntelliJ changes to project B aren't made available to project A until I install it (using the Gradle Maven plugin) in my local repo. This is kind of annoying and slows down my workflow. Is there a way to get IntelliJ to automatically update the dependency internally?
This is supported in the latest versions of Gradle and IntelliJ. It is known as a Composite Build.
Composite builds can be declared in the project's settings.gradle file as follows:
includeBuild '../my-app'
or by using the --include-build command line argument:
$ gradle --include-build ../my-utils run
Take a look at the Composite Builds with Gradle and IntelliJ IDEA Webinar for instructions on how to configure the integration.
In IDEA 2017 you can right-click on the gradle module and use Composite Build Configuration to link the current module to one or more gradle module already opened in the current workspace.

How to put Maven Tycho Dependency in my Eclipse Plug-in?

I've created a new project using tycho 0.26.0, it runs with Eclipse 4 Neon.2, so all modules are building successfully using maven, now I am trying to add a new dependency in my project, I have created a jar and I want to use it in my project, but I don't understand so good how is it working.
I add I am using a target definition, so I have to add my configuration to this file, this will be used by my modules.
I don't know if I got your question right.
I assume you want to build an Eclipse RCP application with tycho and use an JAR file from one of your plug-ins.
The simplest solution is then to create a new plug-in project from this jar by using the Plug-in from existing JAR Archives-Wizard.
If you have done this, you can add a dependency from this new plug-in to your existing plug-ins. Don't forget to export all packages of the library, by opening Manifest.mf and adding all packages in the Runtime tab.
To get this running with maven you have also to add a pom.xml file to the new Plug-in. This link help me a lot with maven tycho (http://codeandme.blogspot.de/p/tycho-articles.html).
Btw. if you don't need this library as plain JAR, you can also create directly a Plug-in project instead of first creating a JAR and then creating a Plug-in project.

Cannot add framework support in IntelliJ 14 Ultimate

I found a pretty old post with this question but unfortunately he didn't get any help. I hope someone can assist me.
I created a repo at GitHub. After cloning it to my computer I tried to add the following framework support: Maven, JSF, EJB, CDI, etc. I know I could add the files manually. But, I want to use what the IDE has to offer.
However, the only framework showing up is SQL, which is different from this post from stackoverflow and from their documentation.
Has anyone had this same problem and got it working?
Intellij reacts to changes in your Maven pom.xml file. Maven does not react to changes in your IntelliJ project module settings.
The steps that you should follow here are
Close IntelliJ
In a command shell, clone your Github repository.
Using an editor external to IntelliJ such as VI or Notepad, create a pom.xml in the root directory. Better yet, use a Maven Archetype to generate your pom.xml.
Now open IntelliJ. Choose File, New, Project From Existing Sources. Navigate to your pom.xml and follow the prompts.
I recommend checking Search for projects recursively and Import Maven projects automatically.
Finish the project creation.
Now, add dependencies to your pom.xml via the dependencies tag. See Maven Dependencies. Intellij will automatically react to dependencies that you add as long as it can see a Maven Repository on your local machine or on your network or on the Internet.
I know it is a little bit to late but I just post it because it is still an possible issue: You need to open YourProjectName.iml and make sure that the type (<module type="JAVA_MODULE" version="4">) is JAVA_MODULE and not something else!(In my case it was WEB_MODULE)

Using Hive in a maven project

I have a project that I am migrating from ant to maven. The project makes use of a lightly-customized Hive build. I figured I would just import this build into our internal maven repo and list it as a dependency in the project's pom file. The problem I'm running into is that the Hive build just generates a bunch of jars in build/dist/lib. Some of these are the core Hive jars themselves and some are jars that Hive depends on. What's the best way to deal with these? Should I put all the core hive jars into our internal repo and just deal with undocumented dependencies in the new project's pom file? Or just jar up everything as a jar of jars and deploy that to the repo? Would that approach even work? Kind of a maven newbie still, thanks for any help.
You should create a POM for your modified Hive build, and deploy it to your internal artifact repo along with the jar. This POM should specify any dependencies (i.e., those other jars). If some of those are also custom versions, you should create POMs for those as well, otherwise just use the standard public groupId/artifactId. This is the Maven way. Note that you don't necessarily need to use the POM for building Hive, just during deployment.
Why you should do this:
If you don't specify the dependencies correctly, you might run into issues when someone forgets to include the full set of dependencies in their project, or specifies the wrong version for one of them
If you create a jar of jars, you might run into issues when someone tries to use the custom Hive "uber jar" as well as a different version of one of those dependencies at the same time. You'll end up with multiple versions of the overlapping classes in the classpath.
The best thing for Maven is always if you tell it everything that is going on. Don't try to tell it what you think it wants to hear.

How to include required jars in project while using Maven?

I am new to Maven and using it to build a project on my local. This is working nicely on my local. Now, I want to run the same project on my server and the server does not have Maven installed. So I wanted to ask if there is any way by which, when I build a Maven project on my local, I could include all the required jars in it and then simply transfer it to my server? I know Maven creates the repository in C:\Documents and Settings\username\.m2 on Windows.
But how can I include all the jars in project the way we do traditionally? I saw this question. But it talks about creating a custom repository and I don't have Maven installed at all. so I guess it is not a suitable solution to me.
Thanks.
You can use the Maven Assembly Plugin. From the documentation:
The Assembly Plugin for Maven is primarily intended to allow users to aggregate the project output along with its dependencies, modules, site documentation, and other files into a single distributable archive.