Missing artifact log4j:log4j:bundle:1.2.16 when using Maven in Eclipse simplistic example - eclipse

I have created simple project from maven-archetype-quickstart under Eclipse Indigo, then I went to pom.xml gui editor and in dependencies tab added dependency on log4j-1.2.16 by search in appropriate dialog.
Now my pom.xml includes tags
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
<type>bundle</type>
</dependency>
But Eclipse underlines first <dependency> tag and says Missing artifact log4j:log4j:bundle:1.2.16.
Why?
The Maven plugin for Eclipse is m2e - Maven Integration for Eclipse version 1.0.100.20110804-1717

Remove
<type>bundle</type>
and it will be fine.
log4j:log4j is actually of type jar.

Related

Is there a way to setup lombok using pom.xml?

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
lombok setup for eclipse
I want to avoid the above steps. Is it possible to setup lombok by itselt when I open the project in STS or Eclipse IDE.
No, Eclipse wouldn't recognize anything that lombok is doing for you adds at runtime while you're inside of Eclipse.

JDK 11 with JAXB and JAXWS works with Eclipse but not IntelliJ

I am converting an application that uses JAXB and JAX-WS from JDK 8 to JDK 11. The code runs when I use Eclipse IDE but exactly the same code fails with IntelliJ IDEA
I have created a Maven project using both Eclipse and IntelliJ IDEA. The problems of finding a working combination of Maven resources has been described in another question. JDK 11 with JAXB and JAXWS problems
The code builds without error in both environments. I have tried creating the IntelliJ IDEA project as a Maven project as well as a standard IDEA project
part of pom.xl
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>11.0.2</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>11.0.2</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.0</version>
</dependency>
<!-- JAXWS for Java 11 -->
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>rt</artifactId>
<version>2.3.1</version>
</dependency>
module-info.java
module org.openfx.gustfx {
requires javafx.controls;
requires javafx.fxml;
requires transitive javafx.graphics;
requires java.xml.bind;
requires java.xml.ws;
requires javax.jws;
opens com.agile.ws.schema.common.v1.jaxws to javafx.fxml;
opens org.openfx.gustfx to javafx.fxml;
exports org.openfx.gustfx;
}
When the code is run from Eclipse, there are no errors.
Running the same code from IntelliJ IDE results in this error
java.lang.ClassNotFoundException: com.sun.xml.internal.ws.spi.ProviderImpl
Searching through the jar files confirms that ProviderImpl.class is now located in com.sun.ws.spi not in com.sun.xml.internal.ws.spi This does not cause a problem with eclipse but IDEA reports the ClassNotFoundException
Therefore, my question "How does eclipse resolve this problem while IntelliJ does not ?"
With help from Roman Shevchenko at IntelliJ, I have solved this problem using the following pom.xml
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.3.2</version>
</dependency>
<dependency>
<groupId>javax.jws</groupId>
<artifactId>javax.jws-api</artifactId>
<version>1.1</version>
</dependency>
and module-info.java
requires java.xml.ws;
requires java.xml.bind;
requires javax.jws;

Maven dependency doesn't get downloaded

I have a Maven Scala project and in the pom.xml I have this dependency
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.11.7</version>
</dependency>
I have this project in Eclipse but for some reason Eclipse keeps telling me that this jar file doesn't exist and it is now shown under Maven dependency section. This is not the case for other dependencies. what is wrong with this one?

Maven eclipse plugin, exclude transitive dependencies

There are several questions about maven and transitive dependency exclusion. However, I don't get it working. I have some dependencies in my pom, that repackaged some libraries, in order to reduce the size of the pom. So far this is successful. But when I'm running mvn eclipse:eclipse these transitive dependencies get written into the .classpath file. Even though they are excluded like in the following excerpt.
<dependency>
<groupId>foo.bar</groupId>
<artifactId>foobar</artifactId>
<version>1.2.4</version>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T13:57:37+02:00)
Java version: 1.7.0_45, vendor: Oracle Corporation
I have found that the m2eclipse plugin for Eclipse provides better integration than maven-eclipse-plugin does. Apache itself has stopped maintaining it and advises going for m2eclipse instead.
Try in Eclipse to "import as Maven Project".

Maven generates old and unwanted RichFaces jars

I have a JSF 2.0 project and when I run 'mvn package' from eclipse (right click on the pom file and run) I get the war file with older versions of the richfaces jars along with the latest jars as shown in the image below.
pom.xml:
<properties>
<org.richfaces.bom.version>4.3.4.Final</org.richfaces.bom.version>
</properties>
<dependencies>
<!-- Mojarra implementation of JSF spec 2.2 -->
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.faces</artifactId>
<version>2.1.6</version>
</dependency>
<dependency>
<groupId>org.richfaces</groupId>
<artifactId>richfaces-bom</artifactId>
<version>${org.richfaces.bom.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.richfaces.ui</groupId>
<artifactId>richfaces-components-ui</artifactId>
<version>${org.richfaces.bom.version}</version>
</dependency>
<dependency>
<groupId>org.richfaces.core</groupId>
<artifactId>richfaces-core-impl</artifactId>
<version>${org.richfaces.bom.version}</version>
</dependency>
</dependencies>
How can I fix this? Any help would be appreciated.
Suggest you to install maven outside of eclipse and try to run 'mvn package' from command line and see if you encounter the same problem in this way as well.
You may also create a 'New Launch Configuration' in eclipse for running mvn package from inside eclipse. To do this, right click on the pom.xml file > Run as > Run configuration ...
Hit 'New launch configuration'. This will take care of any mis-configuration you might have done inadvertently in your earlier launch configuration.