[JAVA] Problems when starting IntelliJ from Maven artifact

The editor cannot recognize the intellisense or the library

I'm using IntelliJ and when I start a project from Maven artifact generation, I can compile it as a Maven task, let alone intellisense, but the editor doesn't recognize it. I was worried quite a bit, but I solved this with a hint

After all,

Project right click> Maven> ReImport

Solved with. (I don't know that)

By the way, when I was investigating before that, I set the source directory and the test directory, though it doesn't matter. The location can be set by selecting the project and going to File> Project Settings> Modules> Source.

But it's probably solved by ReImport.

Slf4j error when running Kafka Client in IntelliJ

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

Damn addicted. Looking at the URL above, it says it's a good idea to add the library to pom.xml. Blogs and Stack Overflow say so, but I couldn't solve it at all. However, he was healed without knowing it. Probably, the setting that added the library should be valid, but it seems that I was looking at the old one, but now I do not know the cause.

   <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>1.7.25</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-jdk14</artifactId>
      <version>1.7.25</version>
    </dependency>

Even if I added the above to pom.xml and tried clear, install, compile, it did not heal, so I tried to check it manually, I put the following plug-in, I was confused, and I ran it from IntelliJ after a long time I don't know what it means, but it worked.

        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>exec-maven-plugin</artifactId>
          <version>1.2.1</version>
          <configuration>
            <mainClass>simplearchitect.App</mainClass>
          </configuration>
        </plugin>

This is probably because I don't understand how IntelliJ behaves. This library is a plugin that runs the app manually, referring to Maven's Dependency, not from IntelliJ. Works with mvn exec: java. It worked fine here.

By the way, to know the version of the target library

mvn dependency:tree

Alternatively, check the IntelliJ maven panel.

Error: java: javacTask:source release 8 requires target release 1.8

This is because the template generated by artifact was 1.7. Rewrite pom.xml.

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
  </properties>

However, this is not enough, and the above ReImport is required. The Target bytecode version of the Preference> Build, Execution, Deployment> Compiler> Java Compiler project is still out of date.

Note not to forget

Recommended Posts

Problems when starting IntelliJ from Maven artifact
IntelliJ starting from 1
Add jar file obtained from Maven to IntelliJ
Set the root URL when starting tomcat in intelliJ
Picture-in-picture starting from iOS14