can't create dependence of msqlconnector in pom.xml in eclipse - eclipse

I can't create the dependency for mysql in eclipse.
error Missing artifact mysql:mysql-connector-java:jar:5.7.9
I use maven console to create the dependency, but It doesn't work
What can I do??

Most likely this is because the current version in 5.* series is 5.1.40.
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.40</version>
</dependency>
There is no version 5.7.9. You can check current version here or all available here.

Related

com.day.cq.dam.commons.util,version=[1.50,2) -- Cannot be resolved

I'm trying to run AEM 6.5 however i'm running into an issue below:
com.day.cq.dam.commons.util,version=[1.50,2) -- Cannot be resolved
It can boot up Author, but there is no content and it looks like that's the only source of the error I can see.
You can add the maven dependency in your pom.xml and build and install the code in AEM and check if this issue still exists.
<dependency>
<groupId>com.day.cq.dam</groupId>
<artifactId>cq-dam-commons</artifactId>
<version>5.6.6</version>
<scope>provided</scope>
</dependency>

How do I update Itext7 to version 7.1.1

This seems like it should be simple but I cannot find anything on how to upgrade to newer versions of itext7. I am using an Eclipse maven project with itext7 version 7.0.4 and would like to update to 7.1.1. However, I can find nothing that tells me how to do that. Neither the Eclipse update menu or the Maven menu has an option to update itext7. Can someone point me to the documentation on how to do an update? TIA.
After answer:
I am not getting the libraries but instead getting conflicts:
I can't seem to post my pom.xml using code tags (I guess the formatter has a problem with XML code because of the <>) but I will include it if someone tells me how. I've uploaded the pom file to DropBox:
pom.xml
(Turning #mkl's and #amedee's comments into an answer)
In your project there is a file pom.xml which contains the Maven project definition. In there is a dependencies section with entries for the iText artifacts (among others). The version is therein. Well, it could also be in a separate dependencies management section or in a parent pom.xml referenced in your file.
As soon as you update the POM file, you can update the Eclipse project configuration in your Eclipse Maven menu. That will, if necessary, automatically download the jar artifacts. If your Eclipse Maven integration is properly configured, that is, and if your computer has proper internet connectivity.
Old versions will remain in your local repository but won't be in the class path anymore.
Also check out our getting started guide. Which contains an example POM snippet.
https://developers.itextpdf.com/itext7/download-and-install-information/Java
If you put your iText version number in POM properties, then you only have to update the value once when you want to upgrade. Like this:
<properties>
<itext.version>7.1.1</itext.version>
</properties>
and then
<dependencies>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>kernel</artifactId>
<version>${itext.version}</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>io</artifactId>
<version>${itext.version}</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>layout</artifactId>
<version>${itext.version}</version>
</dependency>
...
</dependencies>

sbt maven compatibility issues

I am facing an issue with sbt here https://github.com/dmlc/xgboost/issues/1858
strangely not even the maven variables are resolved
com.typesafe.akka#akka-actor_${scala.binary.version};2.3.11: not found
maven outputs these warnings during the build:
Expected all dependencies to require Scala version: 2.11.8
[WARNING] com.typesafe.akka:akka-actor_2.11:2.3.11 requires scala version: 2.11.5
[WARNING] Multiple versions of scala libraries detected!
On a mac hard coding the scala version of the akka dependency seems to be a workaround. For windows or ubuntu this workaround does not work.
edit
<scala.binary.version>2.11</scala.binary.version> in https://github.com/dmlc/xgboost/blob/master/jvm-packages/pom.xml
and
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-actor_${scala.binary.version}</artifactId>
<version>2.3.11</version>
<scope>compile</scope>
</dependency>
in https://github.com/dmlc/xgboost/blob/e7fbc8591fa7277ee4c474b7371c48c11b34cbde/jvm-packages/xgboost4j/pom.xml
which I hard coded to
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-actor_2.11</artifactId>
<version>2.3.11</version>
<scope>compile</scope>
</dependency>
The problem is xgboost is using properties from the pom.xml which are defined in a non-default per profile section. SBT does not seem to be able to handle that
see my pull request here https://github.com/dmlc/xgboost/issues/1858

Missing artifact "sun.jdk:jconsole:jar:jdk"

When adding Arquillian to a Maven build I get the above exception in Eclipse:
Missing artifact sun.jdk:jconsole:jar:jdk
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<version>1.1.7.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.extension</groupId>
<artifactId>arquillian-persistence-dbunit</artifactId>
<version>1.0.0.Alpha7</version>
</dependency>
(The message is not the problem, but that Eclipse refuses to compile the project because of it. Maven works, though.)
Naturally the first thing I did was trying to exclude it from the Maven dependencies (wildfly-arquillian-container-managed is where the dependency tree states the dependency comes from):
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-arquillian-container-managed</artifactId>
<exclusions>
<exclusion>
<artifactId>jconsole</artifactId>
<groupId>sun.jdk</groupId>
</exclusion>
</exclusions>
</dependency>
There was no change. I tried to start Eclipse with -vm C:\Program Files\Java\jdk1.8.0_60\bin. And tried to edit the JDK in "Preferences -> Installed JREs" to contain the JAR in the tools directory. But nothing works.
What can I do?
I put my dependencies like this and it works fine:
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-arquillian-container-embedded</artifactId>
<version>8.1.0.CR1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.15</version>
<scope>test</scope>
</dependency>
<!-- Arquillian -->
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-embedded</artifactId>
<version>8.1.0.CR1</version>
<exclusions>
<exclusion>
<groupId>sun.jdk</groupId>
<artifactId>jconsole</artifactId>
</exclusion>
</exclusions>
<scope>test</scope>
</dependency>
See that the exclusion tag is in the "wildfly-embedded" dependency...
Don't forget to command "mvn install" and click right button at project and "Maven Update", if it doesn't work try delete folder "~/.m2/repository" and download all the dependencies again.
Alastair, thanks for solving the problem. The cause lies in the the pom of the transient dependency org.wildfly:wildfly-cli (8.2.0.Final). There you can find the following dependency declaration:
<dependency>
<groupId>sun.jdk</groupId>
<artifactId>jconsole</artifactId>
<version>jdk</version>
<scope>system</scope>
<systemPath>${java.home}/../lib/jconsole.jar</systemPath>
</dependency>
Actually, the jar is located in ${java.home}/lib/jconsole.jar.
P.S.: The version is also insufficient. So, I deleted this version from my local maven repository.
I faced this while working in a Windows machine. The project itself worked perfectly fine in my Ubuntu machine. However the project's build failed with exactly that message, induced by a transient org.wildfly:wildfly-ejb dependency.
Missing artifact sun.jdk:jconsole:jar:jdk
I didn't feel the project configuration needed to be changed as it's supposed to just work fine across all environments and thus the Windows environment itself must have been wrong. My first thought was that Eclipse itself is in some way using JRE instead of JDK.
So I checked java -version in CMD and it appears to point to a JRE installed somewhere in /Program Files folder while I've always been manually installing JDKs in /Java folder. Then I inspected the %PATH% environment variable in Windows settings. It appears to include a /ProgramData/Oracle/Java/javapath. That folder contained a few symlinks to the JRE in /Program Files folder. That was thus actually being used to start Eclipse and run all its tasks. When I removed it (there was already a JDK/bin further down in %PATH% setting) and restarted Eclipse and re-executed Maven build, the error went away.
No changes needed to pom.xml or Eclipse configuration. Just watch out with what's Windows all installing and updating for you in the background and check your %PATH% if it still has JDK in top.
The reason of the problem is that the jconsole.jar is part of the jdk, thus it is not distributed as an ordinary maven package.
Typically, project pom.xmls insert this jconsole.jar as a system package, i.e. it doesn't even try to download them from the central maven repo. Although it would be possible to distribute it also on this way.
The simplest solution of the problem is to use a jdk which contains this jconsole.jar.
Alternatively, you can download this jar from anywhere, only you have to make it reachable in the compilation classpath.
Or, you can also modify the pom.xml, or install the package manually into your local maven repo, as the other answers state.
I spent the best part of a day fighting this problem. Simple solution is to manually install the missing jar from your jdk using maven, something like:
c:\workspace\prism>mvn install:install-file -Dfile=C:\java\jdk\lib\jconsole.jar -DgroupId=sun.jdk -DartifactId=jconsole -Dversion=1.8 -Dpackaging=war.
Who knows why eclipse cannot do this ...
Maybe is more of a workaround than a proper solution, anyway I solved this issue by removing the profile "activebydefault" in the pom. This way, Eclipse won't complain for the "Missing artifact sun.jdk:jconsole:jar:jdk" but the JUnit test won't run in Eclipse - as I use testing only from maven test, and not the Eclipse embedded JUnit runner, it just need to specify which profile ID you want to run against.
I was facing the same issue, but none of this was a perfect solution for me. Steps to solve :
Check if you are pointing to the JDK location correctly :
echo $JAVA_HOME
Open pom.xml from IDE (mine is eclipse), select Dependency Hierarchy, and search for jconsole. If you see jconsole, it is because sometimes jconsole would be given as an interdependency and the path given could not be recognized. Excluding that jar will solve the issue.
Dependency Hierarchy
Interdependent jconsole
Exclusing jconsole
i was searched jdk full name.
(cos i was used when startethe 1.8.0_191 but after change laptop. its also changed to 1.8.0_282)
so i was searched at STS.
there is a string(java path) at the .factorypath.
so i change that.
its fixed now.
guys try this way~

Using Drools on Jetty

I am trying to start up a webapp that uses Drools 5.2.0.M1. I get the following stacktrace on startup:
java.lang.NoSuchMethodError: org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()[Lorg/eclipse/jdt/core/compiler/CategorizedProblem;
at org.drools.commons.jci.compilers.EclipseJavaCompiler$3.acceptResult(EclipseJavaCompiler.java:336)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:335)
at org.drools.commons.jci.compilers.EclipseJavaCompiler.compile(EclipseJavaCompiler.java:366)
at org.drools.commons.jci.compilers.AbstractJavaCompiler.compile(AbstractJavaCompiler.java:51)
at org.drools.rule.builder.dialect.java.JavaDialect.compileAll(JavaDialect.java:366)
at org.drools.compiler.DialectCompiletimeRegistry.compileAll(DialectCompiletimeRegistry.java:55)
I have the jars in my pom:
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>5.2.0.M1</version>
</dependency>
<dependency>
<groupId>org.eclipse.jdt.core.compiler</groupId>
<artifactId>ecj</artifactId>
<version>3.5.1</version>
</dependency>
Why Can't it find CompilationResult.getProblems()?
JDT isn't backwards compatible.
Check the drools-compiler pom (of exactly the version you're using) on which version of ecj it depends and use that version. Or don't declare ecj at all, it's a transitive dependency for drools-compiler anyway.
PS: upgrade to drools 5.2.0.CR1 (or final once it's out)
I had a similar problem. I was having a web-app using Jetty 6. Jetty 6 which apparently bringing in a non-compatible version of JDT. After switching to Jetty 7 the problem was solved.