The <resultMap> tag property attribute value in the mapper.xml file turns red (entity path error + Lombok and MyBatisX plugin conflict + idea locally installs the lombok plugin)

Cause: After using the MyBatisX plug-in in IDEA, the property attribute value of the <resultMap> tag in the mapper.xml file turns red.

I searched for some solutions on the Internet, and the mapper.xml file may report red. There may be the following two possibilities:

Case 1: The entity path is wrong

To write the full path of the corresponding entity class, you can copy the full path name by right-clicking the entity class to avoid manual input errors:

Case 2: Lombok and MyBatisX plugin conflicts  

Solution 1: Just uninstall the MyBatisX plug-in (a temporary solution, not a permanent solution)

Solution 2: It may be that the Lombok dependency is imported, but the Lombok plug-in is not installed, resulting in a red report

It should be noted that to use Lombok in IDEA, not only must add the lombok dependency in pom.xml, but also ensure that the Lombok plug-in is downloaded and installed in IDEA.

  • Introduce lombok dependency in pom.xml:
<dependency>
    <groupId>org.projectlombok</groupId>
    <artifactId>lombok</artifactId>
    <optional>true</optional>
</dependency>
  • Install the Lombok plugin:

Open IDEA — File — Settings — Plugins — search for lombok — install — Apply — wait for IDEA to restart to complete


Supplement: If IDEA can't find any plug-ins in Plugins, you can try another network first, or you can choose to install lombok locally. The following demonstrates how to install the plugin locally:

Step 1: Open the plug-in official website: JetBrains Marketplace , enter the required plug-in name in the search box, and enter lombok here:

Step 2: Choose the version you want to download:

Step 3: After downloading, put it under a certain disk, no need to decompress, just remember the location of the file

Step 4: Enter IDEA — Annotation processors — tick 

 

Step 5: Enter Plugins, then click Install plugin from disk on the right, find the zip package you just downloaded, and click OK

 

 

Step 6: Finally restart IDEA.

Guess you like

Origin blog.csdn.net/weixin_51909882/article/details/125878455