Where are ArrayUtils.insert() methods in version 3.12.0 - eclipse

I cannot get Spring Framework ArrayUtils.insert() methods to show in Eclipse. The pom.xml has the 3.12.0 version of org.apache.commons.lang3. I can see the methods under Maven Dependencies. However, in the editor, I cannot get to any of the ArrayUtils.insert() methods. Why would that be?
I tried using org.apache.commons.lang3.ArrayUtils and I was able to see the add() methods but not the addFirst() methods.
Are they dependent on Java version or something? The methods are there plain as day in the Maven Dependencies. But, they're compile errors (not found) when I try to use them.

Related

Cross-building Scala libraries

I would like to cross-build some of my Bazel targets to Scala 2.12 and 2.13. As a further point of complexity, I need to be able to express cross-target dependencies (eg. some 2.13 target may have a Bazel dependency on a 2.12 target).
Note: this isn't a regular library dependency (eg. with the dependency 2.12-built JAR showing up on the class path when compiling the 2.13 JAR), as that would almost surely result in issues due to having two incompatible versions of the Scala standard library on the class path. Rather, this is just a case where I need the dependency JAR built so I can use it in some integration tests in the 2.13 target.
What I've found online so far...
This issue from rules_scala seems it doesn't support baking the Scala version into the target and instead you have to pick the Scala version globally.
This Databricks post has a cross-building section that is exactly what I think I would like (eg. one target generated per library per supported Scala version), but the snippets in that post don't seem to be backed by any runnable Bazel code.
This later post by Databricks also hints at a cross_scala_lib rule, but also doesn't have any accompanying code.

Understanding eclipse maven dependency hierarchy

I want to understand the dependencies for a multi-module maven project and for that referred to eclipse dependency hierarchy.
I did understand fairly, however some of the things I am not able to understand at all.
Below is the screen shot.
The things which I didn't understand are:
--> managed from 1.0.2 [Compile}
--> managed from 1.0.2 (omitted for conflict with 1.0.0) [Compile]
I did search online but I got information in traces. Can anyone help me understand what they mean in easy to understand?
Thanks.
Maven builds a flat classpath from the dependency tree each for compiling ([compile]), for testing, and for running.
In a flat classpath, unlike OSGi, a dependency can only exist in one version. In your cropped screenshot, there is on the second level among other things:
kafka-streams 1.0.2 and
kafka-clients 1.0.0.
kafka-streams 1.0.2 requires kafka-clients 1.0.2 which conflicts to kafka-clients 1.0.0. Therefore kafka-streams 1.0.2 is omitted for conflicts with 1.0.0 even if the version 1.0.2 is required here ("managed from 1.0.2").
More detailed:The classpath which is used to compile or run a plain Java application is flat: all required libraries are globally specified as an ordered list. It is not possible to use a library of a specific version for one package and for another package the same library in a different version.In Maven dependencies builds a tree: each dependency might have its own dependencies. Maven maps the tree of dependencies to the classpath, an ordered list of libraries. If in the Maven dependencies tree the same library exists in different versions, it is not possible to create a flat classpath. This is a conflict.This conflict is resolved by picking one version and omitting all other versions. At the place where the picked version is used instead of the required version, (managed from <required but not picked version>) and (omitted for conflict with <picked version to use instead>) is displayed.In addition, Maven can create different classpaths to compile, to test or to run a Java application via so-called scopes. The [compile] scope is the default scope for using a library in all tasks: compiling, testing and running.
Make sure that the versions specified in the pom.xml file are compatible with each other (which is not yet the case in your screenshot): you have to upgrade kafka-clients from 1.0.0 to 1.0.2 (or downgrade the other libraries).

How to fix dependency injection when upgrading play framework from 2.5.x to 2.6.x Scala

I am trying to upgrade from play 2.5.x to 2.6.3. (Because 2.5.x doesn't support multipart post in WS. import play.api.libs.ws.DefaultBodyWritables._ throws Exceptions. The code example in the official document doesn't work. The compiler needs the Body Writables which is not provided until 2.6.x)
So I changed the plugin.sbt version to 2.6.3 and upgraded sbt to 0.13.15. And edit the build.sbt file to add guice and json. The project compiles fine. But when I started with sbt run, and visit http://localhost:9000, it throws a bunch of Exception related to a jar file I have in the local lib/ directory. The same code worked just fine with 2.5.x.
Here's the exception:
1) Error injecting constructor, java.lang.NoClassDefFoundError: com/google/common/util/concurrent/FutureFallback
at db.ConcreteGGDB.(ConcreteGGDB.scala:24)
at Module.configure(Module.scala:29) (via modules: com.google.inject.util.Modules$OverrideModule -> Module)
while locating db.ConcreteGGDB
Any idea if this is related to the local jar is not compatible with 2.6.x? or I need to change some code to do dependency injection other than specify in the Module.scala file? Thanks.
Why am I getting a NoClassDefFoundError in Java?
Error injecting constructor, java.lang.NoClassDefFoundError: com/twitter/finagle/http/Method$Get$
NoClassDefFound means that there's a class that your code needs, but
it can't find it. This typically happens when your project
transitively depends on more than one version of a library. For
example, imagine that you're building project A, which depends on lib
X, and project B, which also depends on lib X. However, project B was
built against an older version of lib X, which used to have a class,
but which it no longer exports.
A => B => X (version 1)
A => X (version 2)
Then when it runs, A makes a call into B, which tries to make a call
into X, but because the project now uses the newer version instead of
the older version, it can't find the class it needs.
I would encourage you to use sbt-dependency-graph to see which
versions of [library name] you're depending on transitively, and ensure that
every library you use uses the same version of [library name].
Looks like an issue with the local jar.

In GGTS, how do I have java classes reference jars from BuildConfig.groovy

Using GGTS 3.6.0M1 with Grails 2.4, I have a java class file that needs an external jar to compile. That jar is defined in BuildConfig.groovy in the "compile" stage, but Eclipse still complains that the references class is not found (because it's not in the Java Build Path).
Since dependency management is performed by Grails, what's the best way to handle dependencies from Java classes that are within Grails projects?
EDIT: Refresh-dependencies doesn't solve the problem of my JAVA classes (under src/java) not seeing the jars in their classpath within Eclipse (showing project errors). If I compile externally - it works (grails compile).

Can I have an AnnotationProcessor defined in maven which will cause compilation errors in my IDE?

Background: I'm adding some annotations to one of our test modules such that everything in a specific package needs to be annotated. I have already written an AnnotationProcessor which does this.
The problem: My processor successfully works for me when I run mvn generate-test-sources and mvn test. However, I would like it to show errors in our development IDEs (Eclipse and IntelliJ). I have not tried with IntelliJ, but with Eclipse, I'm having issues. I've installed m2e-apt, but when I toggled between the settings it didn't seem to work. A test which was not properly annotated was not getting errors (and other modules which didn't inherit the processor plugin got NPEs when being built).
What are my options for having streamlined capability to show errors in IDEs for AnnotationProcessors?