Hello everyone, my name is brother.
I believe that you often encounter some bugs caused by the use of IDEA tools during development, and these problems can only be modified manually, such as compilation problems, command lines are too long, and so on.
I don't understand very well, why some problems IDEA official, do not consider optimization or fundamentally solve these problems? Some friends may think that this is not a problem, this is just that IDEA is not perfect or it is a function reserved by IDEA, it will be deleted later and so on! But it is tentatively designated as a BUG here, and I don't think it is too much.
Although these problems may be simple for some technical bigwigs, for various reasons, I decided to sort out the bugs caused by using IDEA.
Question 1: IDEA running error Commandline is too long message
The detailed error information is as follows:
1
|
Command line is too long.Shorten commandline
for
className or also forJUnit defaultconfiguration
|
Most operating systems have a maximum command line limit, when exceeded, IDEA will not be able to run applications. When the command line is greater than 32768 characters, IDEA recommends switching to dynamic classpaths, where long classpaths are written to files, which are then read by the application launcher and loaded via the system classloader.
Solution:
In the project .idea/workspace.xml file, find the following:
<componentname= "PropertiesComponent" >
...
<propertyname= "dynamic.classpath" value= "false" />
< /component >
Set the dynamic.classpath parameter value to true to solve the IDEA error.
Question 2: IDEA prompts Warning: java: source value 1.5 is obsolete and will be removed in all future releases
Usually when running a Java Web project, IDEA prompts the message:
Warning: java: source value 1.5 is obsolete and will be removed in all future releases
Warning: java: target value 1.5 is obsolete and will be removed in all future releases
Warning:java:To hide warnings about deprecated options, use -Xlint:-options
Solution:
Method 1: Modify the JDK version through IDEA
1) Open ProjectStructure->Project, I use java8, so I choose to use jdk1.8 version for demonstration.
2) Open the Language level of the Sources option in ProjectStructure->Modules and set it.
3) Open File->Settings, find Build, Execution, Deployment options->Compiler->Java Compiler
After modifying the required java version according to the above settings, the message will not be prompted.
Method 2: maven project, modify the pom.xml file
If it is a maven project, then because the default compilation environment of maven is jdk1.5, you need to modify the pom.xml file, add the <properties> property, and add maven.compiler.source and maven.compiler.target to the properties.
Add the following to the pom.xml file:
<profiles>
<!--指定jdk版本为1.8-->
<profile>
< id >jdk-1.8< /id >
<activation>
<activeByDefault> true < /activeByDefault >
<jdk>1.8< /jdk >
< /activation >
<properties>
<maven.compiler. source >1.8< /maven .compiler. source >
<maven.compiler.target>1.8< /maven .compiler.target>
<maven.compiler.compilerVersion>1.8< /maven .compiler.compilerVersion>
< /properties >
< /profile >
< /profiles >
Question 3: Error(*,*) Java: Package does not exist
problem analysis:
In most cases, when the not found message appears, it means that the corresponding file cannot be found in the compiled file. The compiled file of the maven project is output to the target directory by default. Check whether the file with the error message exists in the target directory.
Solution:
Method 1: Refresh the maven project import package
Refer to the picture:
Method 2: Import dependencies
Question 4: No MyBatis mapper was found
After the project is started, the console input error log is as follows:
[org.mybatis.spring.mapper.ClassPathMapperScanner]-NoMyBatis mapper was found in '[com.jingxuan.dao]' package.Please check yourconfiguration.
problem analysis:
Check whether the spring and mybatis configuration files and annotations are accurate. If the taget is deleted and re-completion does not report an error, then it is the problem of idea compilation.
Solution:
1. After deleting the taget file, recompile or execute the maven command to clean. If the same problem still occurs, it indicates that there is a problem with the code or configuration file of the project itself.
2. If the resource configuration file cannot be found in the target directory
Add the following configuration content to the pom.xml file in the maven project:
<resource>
<directory>src /main/resource < /directory ><!--directory-->
<includes><!--scan .properties,.xml files in the directory-->
<include>**/* .properties< /include >
<include>**/*.xml< /include >
< /includes >
<filtering> false < /filtering >
< /resource >
Question 5: Compile the war package and deploy it to tomcat, and report the error \out\artifacts not found for the web module information
Cause Analysis:
The default path of Idea is the root directory/out, and the input path of the maven project is in the target directory, so it needs to be manually adjusted to the root directory/target.
Solution:
Open the Project Structure->Artifacts->Outputdirectory option, and fill in the absolute path of the maven compilation target directory here.