Maven compile and package error: cannot find symbol

 

 

In the project, maven management is used, but several jars are not imported through maven, but imported through IDEA. When compiling with the maven plugin, the following errors will occur:

 

 

 

Solution:

Create a directory lib in the project, then copy the jar to this folder, and finally configure it in the maven compilation plugin as follows

 

 

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                    <encoding>UTF-8</encoding>
                    <!-- Newly added here -->
                    <compilerArguments>
                        <!-- The location where the corresponding jar is placed in the project-->
                        <extdirs>lib</extdirs>
                    </compilerArguments>
                </configuration>
            </plugin>

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327101613&siteId=291194637