mvn package org.apache.pdfbox not found - java

I have these imports (among others):
import org.apache.pdfbox.*;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDPage;
I have this dependency in my pom.xml:
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>2.0.4</version>
</dependency>
I see this line in my eclipse maven dependencies:
pdfbox-2.0.4.jar - C:\Users\Paul\.m2\repository\org\apache\pdfbox\pdfbox\2.0.4\pdfbox-2.0.4.jar
I check the build path in eclipse, and see pdfbox-2.0.4.jar in the Maven Dependencies part.
I run mvn clean compile in a command prompt (Windows).
I get the error "package org.apache.pdfbox does not exist"
I run mvn dependency:build-classpath -Dmdep.outputFile=cp.txt
The following lines are listed in the class path (at the front of the class path):
C:\Users\Paul\.m2\repository\org\apache\pdfbox\pdfbox\2.0.4\pdfbox-2.0.4.jar;
C:\Users\Paul\.m2\repository\org\apache\pdfbox\fontbox\2.0.4\fontbox-2.0.4.jar;
I look in C:\Users\Paul.m2\repository\org\apache\pdfbox\pdfbox\2.0.4\
and I see pdfbox-2.0.4.jar
So what am I missing? Why is the pdfbox jar not being found?

remove this line:
import org.apache.pdfbox.*;
because that package does indeed not exist. The other ones (with deeper levels) are OK.

Related

apache flink not able to resolve imports

Hi iam working on the flink introduction but iam not able to import properly
import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.walkthrough.common.sink.AlertSink;
import org.apache.flink.walkthrough.common.entity.Alert;
import org.apache.flink.walkthrough.common.entity.Transaction;
import org.apache.flink.walkthrough.common.source.TransactionSource;
these above packages are not able to import
i have used from the following site link
in this link i have imported the project via mvn command
please help me resolve this
I just tried this myself, and found that in order to run the application in my IDE (IntelliJ) I had to select the option under Run / Edit Configurations to 'Include dependencies with "Provided" scope'. Once I did that, everything worked fine.
I was able to build the application from the command line (via "mvn clean package") without making any changes.
Can you please verify the below artifact in your maven pom.xml?
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-streaming-java_2.12</artifactId>
<version>1.11.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-walkthrough-table-java</artifactId>
<version>1.11.1</version>
</dependency>

The import com.fasterxml.jackson cannot be resolved error on trying to setup a legacy Java Spring boot application

Following import in an existing class is throwing a compilation error "import cannot be resolved" on eclipse -
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
The corresponding jar inclusion in pom.xml is -
<properties>
<fasterxml.version>0.7.0</fasterxml.version>
</properties>
<dependency>
<groupId>com.fasterxml</groupId>
<artifactId>jackson-module-hibernate</artifactId>
<version>${fasterxml.version} </version>
</dependency>
I checked that the corresponding jar file is not present in .m2.
There is no such directory as jackson-module-hibernate inside .m2/fasterxml/
However, jar corresponding to another declaration is present in .m2 -
com.fasterxml.jackson.core
jackson-annotations
2.6.1
Is present in .m2/fasterxml/jackson/core/jackson-annotations/2.6.1
as jackson-annotations-2.6.1.jar
Setup details
Maven version - 3.3
Java version - 1.8.
Eclipse latest version - 2019-06.
I could not verify the absence of the first jar in the working sandbox setup, but that's how it should be, as we had taken a backup of the .m2 directory. How is it possible that the application runs in another setup without the presence of the jar.
Note - I am still a struggler when it comes to maven dependencies and the setup of this legacy project has made me pull hairs. I am trying to do the setup on eclipse. It got setup sometime back, after a lot of struggle, but before I could document all the steps/workarounds we made, I deleted the working setup by mistake.
Update
The pom declaration for jackson-annotations is in the pom of another project. That project has been included in the pom of the dependent project as -
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.dependencies</groupId>
<artifactId>dependency-project</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
You also need:
Execute mvn clean compile from Command Line, on another project
Execute mvn clean compile on your project
Right-click on Project > Maven > Update project...

Import / Dependency Cannot be Resolved in Maven

I'm using a program that relies on the following two imports:
import org.lwjgl.opencl.CLDevice;
import org.lwjgl.opencl.CLPlatform;
Eclipse is reporting that the "import cannot be resolved" even though I've added LWJGL OpenCL as a dependency to my project.
Here's a snapshot of my POM file:
<dependency>
<groupId>org.lwjgl</groupId>
<artifactId>lwjgl-opencl</artifactId>
<version>3.1.6</version>
</dependency>
I've read somewhere that these classes only exist in an earlier version so I tried changing the version to all of the versions found here ( from 3.1.0 to 3.1.6) but none of them resolved the issue.
Is there an earlier/different version that is not on the Maven repository page? If not where could I find the said class?
Thanks
It seems that you are using the abandoned lwjgl v2 library. It can be found in another Maven repository:
<dependency>
<groupId>org.lwjgl.lwjgl</groupId>
<artifactId>lwjgl</artifactId>
<version>2.9.3</version>
</dependency>

The import retrofit2.converter cannot be resolved

I am unable to resolve error - The import retrofit2.converter cannot be resolved
I am using Eclipse Mars and added following JAR files as External JAR's
retrofit-2.1.0.jar
moshi-1.2.0.jar
it resolves "import retrofit2.Retrofit;" .. but unable to resolve "import retrofit2.converter.moshi.MoshiConverterFactory;"
I am not using Maven .. but just adding JAR files .. any idea?
Thank you,
Jagdish
Added following dependency to pom.xml .. helped to resolved the issue.
<dependency>
<groupId>com.squareup.retrofit2</groupId>
<artifactId>retrofit</artifactId>
<version>2.1.0</version>
</dependency>

package org.hibernate.cfg does not exist import org.hibernate.cfg.Configuration;

I'm using hibernate & I got this error during compilation:
package org.hibernate.cfg does not exist
import org.hibernate.cfg.Configuration;
Did you add the hibernate jar in the build path. Because compiler is not able to find the jar which has this package. So add it and try.
Are you using any IDE??
It seems you don't have hibernate.jar in your classpath.
Add the below dependency to your pom.xml file, save and Maven will do the rest work:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.5.3.Final</version>
</dependency>

Categories

Resources