httpclient version 4.0 works in my pom.xml:
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.0</version>
</dependency>
...but versions > 4.0 don't compile:
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.1</version>
</dependency>
The error:
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).
Project ID: unknown:httpclient
Reason: Parent: null:httpmime:jar:null of project: unknown:httpclient has wrong
packaging: jar. Must be 'pom'. for project unknown:httpclient
Any idea how to use httpclient 4.1 with Maven?
confirmed, use Maven 3.0.x and it works! here is example from working pom.xml
<dependencies>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.2</version>
</dependency>
</dependencies>
I just tried same configurations
jar got downloaded from following location which is one of default repos
http://repo1.maven.org/maven2/org/apache/httpcomponents/httpcomponents-client/4.1
Just try after mentioning http://repo1.maven.org/maven2 explicitly in your pom file
and try using command line
and apache http client 4.1.1 version is also available now
It was a Maven issue: Using Maven 3.0.3 instead of 2.2.1 solved the problem.
Related
I am trying to run tests in Intellij which used to work earlier in spring boot 2.2.x. I recently upgraded to spring boot 2.3.9. When I try to run the test from Run Configurations, it doesn't run the test and throws the error:
'failed to resolve junit platform launcher 1.6.3 intellij'.
However if I run the test in cli, it works fine.
It turns out that, junit5-platform-launcher dependency needs to be added in order for Junit5 tests to run in IntelliJ.
https://youtrack.jetbrains.com/issue/IDEA-231927?_ga=2.5997872.2063517257.1613993298-1098513328.1597974168
https://junit.org/junit5/docs/current/user-guide/#running-tests-ide-intellij-idea
Add this dependency explicitly in pom.xml, and it will solve the issue.
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<scope>test</scope>
</dependency>
I was facing same issue "failed to resolve junit platform launcher 1.8.1" intellij.
IntellJ version: 2021.3
I found answer here and it worked, no need to add any dependency to pom.
Go to settings >> HTTP Proxy >> choose auto-detect proxy settings
For IntelliJ Idea 2021.1, I fixed a similar problem with:
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
Maybe an even better fix is:
<dependencyManagement>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.junit/junit-bom -->
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.7.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
Found the above solution on Jetbrains issue tracker
If you have no direct internet connection but a repository manager like artifactory, idea tries to resolve junit-platform-launcher from there. Make sure u have a mirror to maven central repository (virtual repository) configured and the artifactory url to this mirror is accessible WITHOUT authentication (in the settings for the repo "Force Authentication" should be unchecked).
Check also the idea proxy settings and if needed, configure an exception for the artifactory domain.
Check your proxy settings in IntelliJ Idea settings. I turned ON the proxy and it solved the problem.
Here's the official way to do this
Maven Surefire and Maven Failsafe can run JUnit 4 based tests
alongside Jupiter tests as long as you configure test scoped
dependencies on JUnit 4 and the JUnit Vintage TestEngine
implementation similar to the following.
<!-- ... -->
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.2</version>
</plugin>
</plugins>
</build>
<!-- ... -->
<dependencies>
<!-- ... -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>5.7.2</version>
<scope>test</scope>
</dependency>
<!-- ... -->
</dependencies>
<!-- ... -->
Working with Jackson library, it came following error in Eclipse 4.9.0 version
Missing artifact com.fasterxml.jackson.core:jackson-databind:bundle:2.9.6 pom.xml /Jackson-Usage line 7 Maven Dependency Problem
The problem came when I added maven dependencies by GUI to add dependencies.
The solution was from generated dependencies
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.8</version>
<type>bundle</type>
</dependency>
to remove and save.
<type>bundle</type>
xml
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.9</version>
<type>bundle</type>
</dependency>
Remove bundle and that should resolve the error code in eclipse.
I am trying to use Secure Property Placeholder in mavenized project.
downloaded 1.3.3 secure property connector in anypoint.
loaded 1.3.3 maven dependency in pom.xml
<dependency>
<groupId>com.mulesoft.security</groupId>
<artifactId>mule-module-security-property-placeholder</artifactId>
<version>1.3.3</version>
</dependency>
still getting below error:
Caused by: org.mule.api.lifecycle.InitialisationException: Error creating bean with name 'Secure_Property_Placeholder': Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/mule/security/encryption/MuleEncryptionException
what should i do?
That looks like an old version of the artifact.
Try using this instead:
<dependency>
<groupId>com.mulesoft.security</groupId>
<artifactId>mule-module-security-property-placeholder</artifactId>
<version>1.6.0</version>
</dependency>
Can you check if by adding the following dependencies to your POM file, the issue gets resolved?
`<dependency>
<groupId>com.mulesoft.security</groupId>
<artifactId>security-api</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpg-jdk16</artifactId>
<version>1.45</version>
</dependency>
<dependency>
<groupId>com.mulesoft.security</groupId>
<artifactId>mule-module-security-encryption</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>com.mulesoft.security</groupId>
<artifactId>mule-module-security-property-placeholder</artifactId>
<version>1.4.0</version>
</dependency>`
I am using boxable plugin with pdfbox and I am trying to create a teble. I am getting error:
2015-09-09T10:36:52.453+0200|Severe: java.lang.NoClassDefFoundError: org/apache/pdfbox/pdmodel/edit/PDPageContentStream
at the line of code:
BaseTable table = new BaseTable(yStart,yStartNewPage, bottomMargin, tableWidth, margin, doc, page, true, drawContent);
Here is a part from pom.xml, describing the dependencies that I am using:
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.github.dhorions</groupId>
<artifactId>boxable</artifactId>
<version>1.2</version>
</dependency>
Is there a bug in current version of dependencies or am I missing something?
Thank you very much for any help.
Remove this:
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
2.0 is an unreleased version and is in development, and it has a different API. Boxable has its dependencies in its own pom.xml, it is currently requesting 1.8.8. (Which is not the latest version, but I don't think this matters for simple PDF creation)
My project1 and project2 were working fine with maven builds. Recently I upgraded from maven2 to maven3 using this tutorial (I checked it on maven2,but it didn't work either). Everything worked and is working fine for project2 which has a private (self hosted) Nexus repo.
But, now I am getting error while downloading dependencies for my project1 (using public maven repo).
My pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.dds.server.DDSStartup</groupId>
<artifactId>storage</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>storage</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>r07</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
<dependency>
<groupId>com.sleepycat</groupId>
<artifactId>je</artifactId>
<version>3.3.75</version>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>jgroups</groupId>
<artifactId>jgroups-all</artifactId>
<version>2.4.1</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>oracleReleases</id>
<name>Oracle Released Java Packages</name>
<url>http://download.oracle.com/maven</url>
<layout>default</layout>
</repository>
</repositories>
</project>
Where am I going wrong, this is the error I get when I do a : mvn clean package
[ERROR] Failed to execute goal on project storage: Could not resolve dependencies for project com.dds.server.DDSStartup:DynamicDistributedStorage:jar:1.0-SNAPSHOT: Failed to collect dependencies for [junit:junit:jar:3.8.1 (test), com.google.guava:guava:jar:r07 (compile), log4j:log4j:jar:1.2.16 (compile), com.sleepycat:je:jar:3.3.75 (compile), com.google.protobuf:protobuf-java:jar:2.3.0 (compile), jgroups:jgroups-all:jar:2.4.1 (compile)]: Failed to read artifact descriptor for log4j:log4j:jar:1.2.6: Could not transfer artifact log4j:log4j:pom:1.2.6 from/to oracleReleases (http://download.oracle.com/maven): /Users/username/.m2/repository/log4j/log4j/1.2.6/log4j-1.2.6.pom.ahc65d8d087349b4a46 (No such file or directory) -> [Help 1]
UPDATE:
I deleted everything (workspace), imported the project again and it worked like a charm. Nothing can beat that solution! ;)
This shouldn't be working with maven2 either.
From the error message, it looks like maven is trying to download dependencies from the repository specified in your pom - oracleReleases (http://download.oracle.com/maven) and not the public maven repo. This appears to be an invalid repository url.
Perhaps you should try removing the section and retry.
This is covered by another stackoverflow question which boils down to the Oracle repo not allowing directory listings.
I had the dependencies versions externalized as properties. Like:
<properties>
[...]
<hibernate-core.version>4.1.3.Final</hibernate-core.version>
[...]
</properties>
And:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate-core.version}</version>
</dependency>
I closed the project, changed the version declaration to be explicit as
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.1.3.Final</version>
</dependency>
it worked!
The URL in orcacleReleases seems wrong, it does point to a 404, maybe oracle did move it ?