Intellij extract maven dependency to artifact - java

I am currently having an issue with IntelliJ.
I have several dependencies in my pom. However, when I generate an artifact, I can add the maven libraries but instead of maven extracting the jar contents, Maven instead pops the entire jar into the artifact jar. This results in my program failing to load. How can I get IntelliJ to not do this and instead extract the jar contents into the build?
I configured the artifact manually through intelliJ
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
<scope>compile</scope>
</dependency>
Thank you.

Related

How to add a fat/uber jar as dependency in pom.xml

I'm newbie on maven.
My question is this:
I have a far jar in nexus, and want to add it as dependency in a pom.xml.
How can I do that?
In nexus there are both the jar and the fat jar.
Inside my pom.xml I'm using:
<dependency>
<groupId>com.xxxxxxxxxxxx.sar</groupId>
<artifactId>kafka-connector</artifactId>
<version>5.0.0-SNAPSHOT</version>
</dependency>
and, of course, it is not downloading the fat jar.
How do I fix that?
Using a classifier is the right way to go:
<dependency>
<groupId>com.xxxxxxxxxxxx.sar</groupId>
<artifactId>kafka-connector</artifactId>
<version>5.0.0-SNAPSHOT</version>
<classifier>fat</classifier>
</dependency>
I would check if the fat is a consumable artifact.
add the dependency to your pom.xml
<dependency>
<groupId>com.xxxxxxxx</groupId>
<artifactId>example-app</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/lib/yourJar.jar</systemPath>

How to install Processing using Maven?

I want to install processing via maven in intellij. I have added the following to my POM file:
<dependencies>
<dependency>
<groupId>org.processing</groupId>
<artifactId>processing-complete</artifactId>
<version>3.3.7</version>
</dependency>
</dependencies>
When trying to build, it says Cannot resolve org.processing:processing-complete:3.3.7
However, the file is definitely there in the repository: https://repo.maven.apache.org/maven2/org/processing/processing-complete/3.3.7/
anyone has any idea how to successfully build the complete processing library using maven or gradle?
PS. I am a huge noob with maven, so it might be something simple, but I've tried a bunch of stuff and nothing seems to work.
Edited to have the maven log: from mvn -X dependency:sources
https://gist.github.com/jurrejelle/91b59785c7a3184e776f0a1797c416f4
Your dependency section is asking for a jar file (the default type), which isn't present in the artifact. If you look on Maven Central, you can see that the given dependency tag includes a pom type tag:
<dependency>
<groupId>org.processing</groupId>
<artifactId>processing-complete</artifactId>
<version>3.3.7</version>
<type>pom</type>
</dependency>
I was able to reproduce your error using the XML you posted, and adding <type>pom</type> in my pom.xml cleared up the error for me.

How to resolve Microsoft Azure dependencies on Eclipse

I'm trying to follow "How to run a compute-intensive task in Java" tutorial.
However, I'm stuck on the following step:
https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-windows-classic-java-run-compute-intensive-task/#how-to-create-a-java-application-that-performs-a-compute-intensive-task
Eclipse shows an error saying that these dependencies can't be resolved:
import com.microsoft.windowsazure.services.core.Configuration;
import com.microsoft.windowsazure.services.core.ServiceException;
import com.microsoft.windowsazure.services.serviceBus.*;
import com.microsoft.windowsazure.services.serviceBus.models.*;`
I'm using Eclipse and I've downloaded the Azure toolkit for Eclipse.
Here's how my Eclipse project looks like:
The code is simply a copy-paste of TSPSolver.java.
Per my experience, the issue was caused by missing some dependent libraries that you can try to add them via configure the Java Build Path or configure the pom.xml file in the Maven project to resolve it.
For the first way, adding the dependent libraries via configure the Build Path. You can download these libraries and their dependencies from the link.
Right click on the project name, then select Build Path and click Configure Build Path.
Add these jar files via click Add External Class Folder
For the second way, adding the maven dependencies in the pom.xml file.
Convert the current normal Eclipse Project into a Maven project.
Open the pom.xml file in the project and add the below content from link1 & link2.
<dependencies>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-core</artifactId>
<version>0.9.7</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-servicebus</artifactId>
<version>0.9.7</version>
</dependency>
</dependencies>
For those looking now, latest version are as follows:
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-storage</artifactId>
<version>8.0.0</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-servicebus</artifactId>
<version>3.6.7</version>
</dependency>

Errors in maven Struts2 project

Eclipse displays errors in a Maven project. How can I fix it?
It seems that project works as it should.
Maven dependencies:
<dependency>
<groupId>com.jgeppert.struts2.jquery</groupId>
<artifactId>struts2-jquery-plugin</artifactId>
<version>3.7.1</version>
</dependency>
<dependency>
<groupId>com.jgeppert.struts2.jquery</groupId>
<artifactId>struts2-jquery-grid-plugin</artifactId>
<version>3.7.1</version>
</dependency>
The jars downloaded from these artifacts should be on the classpath of the project Build Path. Subfolders aren't on the classpath, so eclipse can't find TLDs there. Configure the build path by adding project or external jars to the build classpath. You can see How to generate eclipse configuration from maven project.
Try /struts2-jquery-tags instead of /struts-jquery-tags. Missed the '2' in struts.

Why the Groovy jar be referenced in Eclipse?

My project doesn't reference the groovy-all-1.8.3.jar, and the jar is not in the maven dependency tree and .classpath file.
When the project is imported to Eclipse, it notices that the groovy-all-1.8.3.jar is referenced.
How can the jar be referenced?
In the Maven Project put the following dependency in pom.xml
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>1.8.3</version>
</dependency>
And run mvn clean install , It solves your problem.

Categories

Resources