Intellij can’t import dependency import by spring-boot-starter - maven

I want use org.yaml.snake.Yaml in my springboot application. Since the spring-boot-starter has already included the snakeYML. thus I don't need import the org.yaml.snake.Yaml again in my pom.xml file.
when I type import org.yaml.snake.Yaml in source code, eclipse can exactly import it. However, when I use the Intellij it can't import the package.
As I edit the pom.xml and add below:
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.10</version>
</dependency>
It works fine!
I wander is this a bug of intellij?

Related

Java sax parser setup in Maven

I having trouble getting to first base with SAX XML parsing. I'm using Maven for my java coding.I'm trying to parse a mitochondrial haplotree.
I have this dependency in my pom.xml:
<!-- https://mvnrepository.com/artifact/sax/sax -->
<dependency>
<groupId>sax</groupId>
<artifactId>sax</artifactId>
<version>2.0.1</version>
</dependency>
However, in my code I get errors with
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
I've tried several other pom and import options found on the internet, but cannot get the code to recognize the imports.
What am I missing?

how to import a Maven dependency using SBT

I am trying to get embedded-cassandra in my scala/play project which uses sbt instead of maven. (https://github.com/nosan/embedded-cassandra/wiki)
I translated the following maven dependency into sbt.
<!-- Core API -->
<dependency>
<groupId>com.github.nosan</groupId>
<artifactId>embedded-cassandra</artifactId>
<version>2.0.1</version>
</dependency>
<!-- Test Extensions (Spring, JUnit, etc.) -->
<dependency>
<groupId>com.github.nosan</groupId>
<artifactId>embedded-cassandra-test</artifactId>
<version>2.0.1</version>
<scope>test</scope>
</dependency>
SBT conversion
"com.github.nosan"%"embedded-cassandra" % "2.0.1" % "test"
But I am getting compilation error when I try to import embedded-cassandra in my unit test.
import com.github.nosan.embedded.cassandra.Cassandra
error
Error:(7, 12) object github is not a member of package com
import com.github.nosan.embedded.cassandra.Cassandra
What am I doing wrong?
Turns out, the issue was that SBT hadn't downloaded the dependency. I re-imported the project and things worked. I made another change. I removed the % test from the sbt entry though to be honest I don't know if that had any implications.

import of amqp from org.springframework get error

I'm working on existing Scala project which using the spring framework and I need to import org.springframework.amqp but when I tried to build the project I get:
Error:(15, 28) object amqp is not a member of package
org.springframework import org.springframework.amqp
It is really strange since I can see it in the formal website and I can see it in lot of examples in the web.
Any idea what is the problem?
A Maven dependency was missing. This is what I was need to add:
<dependency>
<groupId>org.springframework.amqp</groupId>
<artifactId>spring-amqp</artifactId>
<version>2.1.2.RELEASE</version>
</dependency>

Dependencies added but can't import correctly?

<dependency>
<groupId>com.jde.jimie.data</groupId>
<artifactId>jde-jimie-sdk</artifactId>
<version>3.0-SNAPSHOT</version>
</dependency>
But when I tried to import a library from it, it says can't resolve the symbol.
import com.jd.jimie.data.sdk.eDataClient;
Specifically, in IntelliJ, it shows that "can't resolve symbol 'data'".
I restarted IntelliJ, but the problem persists.

Hadoop imports cannot be resolved in eclipse

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
Learning hadoop programming from scratch.
I have written above line of code in eclipse.
it is showing error as "import org.apache.hadoop.io. cannot be resolved.".
I have already added external jar file "Hadoop-mapreduce-client-core-2.7.3,jar"
Is there anything else to add ?
In your all the dependents jar needs to be added, a single jar file wont help.
Try Using Maven.
Dependency is available on below link.
https://mvnrepository.com/artifact/org.apache.hadoop/hadoop-core/1.2.1
1) Convert the project to a maven project if it's not yet.Project>Configure>Convert to maven project.
2)Add this dependency :
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-core</artifactId>
<version>1.2.1</version>
</dependency>
This should resolve your errors. This worked for me!

Resources