Can't install net.liftweb:lift-json_2.13 in Databricks - lift

I am trying to install net.liftweb:lift-json_2.13:3.4.1 into a Databricks cluster (Apache Spark 2.4.4, Scala 2.11)
However I am getting the following error:
java.lang.RuntimeException: unresolved dependency: net.liftweb:lift:1.2.1: not found
When I try to install the net.liftweb:lift:1.2.1 I am getting the following error:
Maven Dependencies not found: unresolved dependency: net.liftweb:lift:1.2.1: not found Please try again by excluding these dependencies.
I also had no success with other versions.

To make third-party or locally-built code available to notebooks and jobs running on your clusters, you can install a library. Libraries can be written in Python, Java, Scala, and R. You can upload Java, Scala, and Python libraries and point to external packages in PyPI, Maven, and CRAN repositories.
Steps to install third party libraries:
Step1: Create Databricks Cluster.
Step2: Select the cluster created.
Step3: Select Libraries => Install New => Select Library Source = "Maven" => Coordinates => Search Packages => Select Maven Central => Search for the package required. Example: (lift json) => Select the version ( net.liftweb » lift-json_2.13 » 3.4.1) required => Install
Successfully installed ( net.liftweb » lift-json_2.13 » 3.4.1) library.
For more details, refer "Azure Databricks - libraries".
Hope this helps. Do let us know if you any further queries.

Related

Liferay unresolve requirement: Import package

I have a module in 7.2 Liferay environment, in the modules folder. I've compiled everything by running the commands:
1 - blade gw jar inside the modules folder
2 - gradlew distBundle
3- gradle deploy
From there I get into the Tomcat directory and get the following error:
org.osgi.framework.BundleException: Could not resolve module: cuatroochenta.rest [1141] _ Unresolved requirement: Import-Package: com.liferay.asset.category.property.model; version = "[2.1.0,3.0.0)" _ [Sanitized]
I have been searching but the information it gives regarding the error is also not very clear and I have not found an explicit solution.
Any ideas ??
Thank you so much
add below lines in bnd.bnd file of your module :
Import-Package: \
!com.liferay.asset.category.*,\
!com.liferay.asset.category.property.*,\
*
Note:- need to add all those packages who show unResolved Requirement.

How do I find the correct Maven archetype project for developing with Scala in Eclipse?

I'm having problems trying to just create a Maven project using Scala (v2.11.6) within Eclipse (Luna). The instructions here says to install both plugins below.
Maven Integration in Eclipse
m2eclipse-scala connector
Both plugins can be installed by using the m2eclipse-scala update site. So here's what I did in my first attempt.
Download Eclipse Luna (for JavaEE developers)
Install "both" plugins above by using the m2eclipse-scala update site.
When Eclipse loads up, I attempt to create a Maven project, and the archetype I want to use is Group Id=net.alchim31.maven, Artifact Id=scala-archetype-simple, Version=1.5. However, this archetype never shows up when I enter in "scala-arch" in the filter text field.
The only project I see is the one with Group Id=org.scala-tools.archetypes, Artifact Id=scala-archetype-simple, Version=1.2. When I select this archetype to use, I get a bunch of error messages in Eclipse.
error while loading ConsoleRunner, Scala signature ConsoleRunner has wrong version expected: 5.0 found: 4.1 in ConsoleRunner.class
error while loading JUnit4, Scala signature JUnit4 has wrong version expected: 5.0 found: 4.1 in JUnit4.class
error while loading Specification, Scala signature Specification has wrong version expected: 5.0 found: 4.1 in Specification.class
In my second attempt, I try to download the pre-packaged bundle (Scala IDE for Eclipse). Again, when I attempt to create a Scala Maven project, I don't see the Maven archetype for Group Id=net.alchim31.maven (only for Group Id=org.scala-tools.archetypes).
Any ideas on what I'm doing wrong here? Or where I can find a vanilla Scala Maven project to import/modify and use for my own purpose?
Here's how I got it to work. It seems all the archetypes aren't available, so based on this answer, I created a remote catalog
Before
So do this
Go to [Windows] → [Preferences] → [Maven] → [Archetypes] → Add Remote Catalog and create the catalog, then Apply
For copy-pasting:
Catalog File: http://repo1.maven.org/maven2/archetype-catalog.xml
Description: Remote Archetypes
Go back to creating a new Maven project. Select the Remote Catalog from the dropdown. It will take a few moments to gather all the archetypes. You can see the progress at the very bottom right of the IDE. When it's done, you should be able to see the archetypes
After
Create your project with groupId and artifactId and such.
Right click the project, then from the context menu [Run As] &rarr [Maven Build]. In the dialog, type clean package into the goals. The run. The project should build and run the tests.
For me at first I got an error on the build. It was because my default environment is using Java 8. I'm pretty new to Scala, so I'm not sure is there is a problem with Scala and Java 8 or not (I think it's the Scala version in the pom (2.10.0)). But what I did to get it to work was just change the Java version used in the IDE to Java 7.
Basically just go to [Windows] → [Preferenes] → [Java] → [Installed JREs] → Add → [System VM] → Next → Directory → Find the directory of the Java home (version 7) → Finish → Then in the list tick Java 7.
Then build again. It should work. Good Luck!
One point I want to add, If you are getting following error while installing the archetype showed in image 1
Can't resolve Archetype
org.glassfish.jersey.archetypes:jersey-quickstart-webapp:2.21
org.eclipse.core.runtime.CoreException: Could not resolve artifact
org.glassfish.jersey.archetypes:jersey-quickstart-webapp:pom:2.21
Image 1:
Then before procedding with the solution specified above, try to complete these steps in eclipse.
I faced the same problem and chanced upon this SO question, as well as the answer, given by #peeskillet (many thanks). I am using:
Maven 3.3.3
Eclipse Luna Scala IDE 4.0.0.-vfinal-20150305-1644-Typesafe
Scala 2.11.6
JDK 1.8
After following the steps exactly as given here, I hit a wall. When I chose the right archetype (net.alchim31.maven), I was greeted with this error:
Could not resolve artifact net.alchim31.maven:scala-archetype-simple:pom:1.5
Suspecting that the maven embedded in eclipse was acting funny, I visited [Windows] -> [Maven] -> [Installations] and added local installation of maven (whatever is set to M2_HOME in my shell). But, no luck!
Exasperated, I visited this site: Scala Doc and switched back to command-line as this page instructs. Surprisingly (to me, at least), it worked. A maven-Scala project was created in the present directory, which I could import into Eclipse.
Just so that I am not misunderstood, I am not suggesting that #peeskillet's answer is wrong. Just wanted to share another way of creating a maven-scala project on Eclipse, in case it helps someone. I have not yet understood, why Eclipse-Scala-IDE is yet to give that 'Aha' feeling.
After you have successfully created the scala-maven project as described above, you will probably see an error "Type not found: type JUnitRunner specs.scala". In that case, manually add the following XML snippet to your pom.
<dependency>
<groupId>org.specs2</groupId>
<artifactId>specs2-junit_${scala.compat.version}</artifactId>
<version>2.4.16</version>
<scope>test</scope>
</dependency>
Moreover, to avoid errors when running mvn test,
[ERROR] scalac error: bad option: '-make:transitive'
You also need to delete the following line from the pom.xml file:
<arg>-make:transitive</arg>

Installing SBT on Win 7 64 bit

I want to install Apache Spark for testing purpose. For that I found out that Scala and sbt are necessary. I downloaded scala msi and installed it. For installing sbt I tried various methods but am unable to do so. Can someone tell me what am I doing wrong. What I did is
Install Scala msi
Download sbt msi and install it.
Set sbt_home and path variable to the location where sbt is extracted. Then I opened cmd to check my sbt version by using sbt sbt-version I am getting the following error **unresolved dependency:
org.fusesource.jansi#jansi;1.11: not found
Error during sbt execution: Error retrieving required libraries (see C:\Users\ashish-b\.sbt\boot\update.log for complete log) Error: Could not retrieve jansi 1.11 **
Whats wrong in it?
I saw this issue as well when connecting to the internet via a corporate proxy. In this case, sbt couldn't download its dependencies.
We work with a proxy Maven repository for depedencies. Configure sbt to use a proxy repo.
Our sbt repositories file looks like this:
[repositories]
local
local-maven: file:///C:/data/maven_repo/
aaa-ext-ivy-proxy: http://nexus-ext.company.net:8081/nexus/content/groups/ivy-public/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
aaa-ext-maven-proxy: http://nexus-ext.company.net:8081/nexus/content/groups/public/
aaa-int-maven-repo: http://nexus-int.company.net:8081/nexus/content/groups/public/
Or you can also configure the proxy server directly for SBT, see this question.

maven in command line succeed, but failed when using the same maven in eclipse

I'm trying to build the project of hadoop. I followed the official document as follows on how to do that.
http://wiki.apache.org/hadoop/HowToContribute
https://wiki.apache.org/hadoop/EclipseEnvironment
I've git clone the project, maven install it successfully, but when I import the project, or even a sub-project like 'hadoop-yarn-api', I got the following errors on maven:
Description Resource Path Location Type
Plugin execution not covered by lifecycle configuration: org.apache.hadoop:hadoop-maven-plugins:3.0.0-SNAPSHOT:protoc (execution: compile-protoc, phase: generate-sources) pom.xml /hadoop-yarn-api line 73 Maven Project Build Lifecycle Mapping Problem
Then I'm trying to mvn clean install the project via External Tools Configuration in eclipse, it also failed on:
[ERROR] Failed to execute goal org.apache.hadoop:hadoop-maven-plugins:3.0.0-SNAPSHOT:protoc (compile-protoc) on project hadoop-yarn-api: org.apache.maven.plugin.MojoExecutionException: 'protoc --version' did not return a version -> [Help 1]
But the curious part is that when I cd into the root directory of 'hadoop-yarn-api' and invoke mvn clean install, it can be built successfully.
I'm using m2ecipse in eclipse, and I'm sure that I've changed to the maven which is exactly the one that I'm used in command line, not the embedded one.
And I've installed protocol buffers 2.5.0:
$ protoc --version
libprotoc 2.5.0
Could anyone give me some idea? Many thanks!
P.S.
Eclipse Java EE IDE - Juno Service Release 2
m2e - 1.4.1.20140328-1905
Mac 1- 0.9.4
maven - 3.0.5
Hadoop - 2.2.0

How to change Eclipse-Groovy plugin Groovy libraries?

I am using the newest version (2.8.0) of the Eclipse-Groovy plugin that ships with groovy-all-2.1.5.jar. I added Guice to my Groovy project, and when I go to run them from inside Eclipse I get the following error in the console output:
Caught: java.lang.NoClassDefFoundError: org/codehaus/groovy/runtime/typehandling/ShortTypeHandling
java.lang.NoClassDefFoundError: org/codehaus/groovy/runtime/typehandling/ShortTypeHandling
at net.me.myapp.utils.restclient.RestClient.<init>(RestClient.groovy:57)
at net.me.myapp.inject.UserServiceClientModule.configure(UserServiceClientModule.groovy:34)
at com.google.inject.AbstractModule.configure(AbstractModule.java:59)
at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:223)
at com.google.inject.spi.Elements.getElements(Elements.java:101)
at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:133)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:103)
at com.google.inject.Guice.createInjector(Guice.java:95)
at com.google.inject.Guice.createInjector(Guice.java:72)
at com.google.inject.Guice.createInjector(Guice.java:62)
at net.me.myapp.UserServiceClient.<init>(UserServiceClient.groovy:37)
at net.me.myapp.UserServiceClient.main(UserServiceClient.groovy:45)
Caused by: java.lang.ClassNotFoundException: org.codehaus.groovy.runtime.typehandling.ShortTypeHandling
... 12 more
According to this answer it's because ShortTypeHandling wasn't added until 2.3.x. So I would now like to attach groovy-all-2.3.3.jar to my Eclipse project's classpath.
The problem is that I don't seem to have edit permissions to change what library the Groovy Libraries library uses under the hood. And when I manually add the 2.3.3 JAR to my build path, I get the following error:
Caught: java.lang.ExceptionInInitializerError
java.lang.ExceptionInInitializerError
Caused by: groovy.lang.GroovyRuntimeException: Conflicting module versions. Module [groovy-all is loaded in version 2.1.5 and you are trying to load version 2.3.3
What are my options?
Groovy-eclipse versions have its own compilers and are "locked" to them. You may change the versions to whatever is listed under Window > Preferences > Groovy > Compilers, but, AFAIK, you can't change to an arbitrary version of the compiler by simply changing the groovy-all jar in the guts of the plugin dir.
You can install new compiler versions using the update site or eclipse marketplace
Update: install additional compiler versions through Help > Install new Software, select Groovy update site and expand the Extra Groovy Compilers session:
Note i'm using snapshot update site, because i like to live dangerously.