Tag Archives: idea

IntelliJ idea error: package not found or symbol not found

The article directories
IntelliJ IDEA error: package not found or symbol 1 not found. Use maven-reimport2.Invalidate and Restart3. 4. Recompile. 5. Use maven-install

IntelliJ IDEA Error: Could not find package or symbol

Appeared recently in the use of the IDEA of time, suddenly can’t find the package or can’t find the symbol of the situation, for the existence of their reference in determining the circumstances, can try the following several ways to solve, the following is a touch also solve during the development process of several ways, also Shared with everyone under the record, I hope it can help you.

1. The use of Maven – Reimport

2.Invalidate and Restart


3. Uniform coding

4. Recompile

Points to open the Project Structure program compiled output directory

will target directory file to empty

right click the Project to build

5. Use Maven – Install

maven-install / code> maven-install maven-install maven-install maven-install maven-install > maven-install / code> maven-install >

code> m>nstall
>install
MVN install If you are not familiar with this, you can go to Baidu by yourself.

Brief introduction of idea Lombok and solutions for reporting red and wrong

idea lombok
Introduction of lombok
Lombok is a Java library that automatically switches on editors and build tools. For simple Java objects, you can substitute getters and Setter methods in code with annotations such as @setter @getter. Lombok uses annotations, but instead of using reflection, it dynamically replaces annotations with concrete code at compile time. So the actual code that the JVM runs is the same as the classes that we write manually that contain the various tool methods.
Lombok annotations
Val: final declares a variable in fianl just like a dynamic language does. Var: with JDK10 @ Data: annotation on the class, will provide all of the attributes of the class to add the get and set methods, and add, equals, canEquals @ Setter, hashCode, and toString method: annotation on the class, add a set method for all attribute, comments on the property for the attribute set method @ Getter: annotation on the class, add the get method to all of the properties, comments on the attribute of the attribute provides the get method @ NotNull: When used in the parameter, if pass the null values when the call, will be thrown null pointer exception @ Synchronized to method, can lock the specified object, if not specified, the default to create an object locking @ the Log function in the class, create a Log properties @ Builder: using the Builder pattern to create objects @ NoArgsConstructor: create a a no-parameter constructor @ AllArgsConstructor: create a full constructor @ ToString refs: Create a ToString method @accessors (chain = true) that uses the chain setting property. The set method returns this object. @RequiredArgConstructor (StaticName = “of”) creates and generates a static method @UtilityClass: Utility class @ExtensionMethod: Sets parent class @FieldDefaults: Sets the scope of properties, such as private, public, etc., and can also set whether properties are final modified. @cleanup: Close streams, join points. @equalSandHashCode: Overrides the equals and hashCode methods. @toString: Create the toString method. @cleanup: Can be used for streams etc without needing to close the use of stream objects.
Lombok error resolution:
1. Use compiler to select javac
2. Enable Annotation Processing

. After installation, restart IDEA. Gives effect to the plugin
4. Maven versions do not agree with the idea lombok version


4. Idea2018 version
IntelliJ idea 2018.1.5 \ plugins \ android \ lib \ templates \ gradle \ wrapper \ gradle \ wrapper
idea under the install directory
ideaVersion=2018.1
start idea then manually install Lombok plugins and restart again

Common faults and solutions of sylixos IDE (1)

Fault description
New notebook (Lenovo new Air14), the system updated to the latest win10-1909, the new installation of IDE flagship version (3.9.10)
will be other computer normal engineering copy over, compiler report error. “Arm-sylixos-eabi-lzocom. exe application error”
after closing the error, can continue to compile, and finally can compile.



Solution:
After loading vc2010_redist_x86.exe, the problem no longer appears.
IDE later versions will no longer have this problem.

Solve the problem that data cannot be input in idea console

IDEA console cannot be entered
If you are using IDEA and you find that you cannot input from the console while testing with JUnit, you need to make the following changes to make the configuration successful
Step 1: Help –Edit Constom VM Options…

Step 2: open the configuration, add – Deditable. Java. Test. The console = true

If the configuration is successful, restart IDEA and the problem will be solved

Idea Maven project uses package to package and report error (package does not exist)

Scene: I pass File -> Project Structure -> Modules and Libraries have added an external Jar that runs normally in the project, but the following error occurred when packaging with Maven’s package

Solution: Configure the Jar to a pom.xml file and you can package it properly
Steps:
1. Open the Terminal execution (Terminal window at the bottom of the IDEA interface)

mvn install:install-file -DgroupId=com.external -DartifactId=http-sdk -Dversion=1.2.6-SNAPSHOT -Dpackaging=jar -Dfile=C:\Users\Administrator\Desktop\BOOT-INF\lib\http.jar 

2. Add the following dependencies to the pom.xml file

<dependency>
    <groupId>com.souche</groupId>
    <artifactId>msgcenter-sdk</artifactId>
    <version>1.2.6-SNAPSHOT</version>
</dependency>

The -dgrouPID corresponds to the groupid-dartifactid in the POM and the artifactitid-Dversion corresponds to the version-dpackaging import package which is a TYPE of JAR and that’s the jar-DFile where you put the JAR that you downloaded from the POM

Once you run the command, you can see the corresponding JAR in the local Maven repository

 

And then re-execute
Compile and package MVN Clean Package (install)
Or choose the right side of the IDEA interface, select the Maven status bar and click package packaging

 

 

The required configuration in the POM.xml file

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

 

 

java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @Context


issue the following error when unit testing

java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @Context

There are two reasons for this problem

1. See if there is a primary startup class

2. As shown in the figure above, if the main boot class already exists, the error may be in the test directory and will be reported if they are not in the same directory.
Put it in the same directory and the problem is solved.

Solution to the problem of Chinese garbled in gradle console in idea

1. Background:

Mowday, Xiaoming received the task from his superior and needed to develop a Gradle project in IDEA. When writing the test case, the following error occurred


2. The environment is as follows:
The IDEA 2019.3 Gradle 5.2.1 Java 1.8.0 comes with
3. Try the following
In the IDEA menu File==> Settings==> Edit==> Various UTF-8 are set in File Encoding. No effect. is also configured with UTF-8 in Gradle RunConfigurations. Still no effect of
Gradle and Gradle. Bat both join set DEFAULT_JVM_OPTS=” -dfile.Encoding =UTF-8″. Still not encoding!!
4. Final solution
Edit Help | Edit Custom VM Options in IDEA, adding the following parameters

-Dfile.encoding=UTF-8


The effect is as follows, problem solved

 
conclusion
In the emergence of Chinese disorderly code problem. The first time I thought of the coding format.
A compilation error occurred during gradle execution. Chinese encoding and IDEA encoding are inconsistent. Therefore, ensuring consistent encoding of the encoding file and IDEA is the key to solving the problem.
In CUSTOMER VM option in IDEA, the file encoding can be customized as UTF-8.

Git uploads local IntelliJ idea project to GitHub

one Install the Git client
Install git client under Window.
 
two Configure Git/ GitHub in Intellij idea
Open Preference– Version Control.
 
Drop down and select Github, fill in Host, Login, and Password, and Test was successful.
 
Select Git and specify the Git path. Test to see if the function is working.
 

 
 

3. Project local Git commit
1. Create a local warehouse

 
2. Commit code to Git

 
Right-click on the SRC or code file, and Git — Add — Commit
 
Four. Project remote submission
1. Set up a warehouse on Github
2. Configure the remote warehouse locally
CD local warehouse directory
Git RemoteAdd Origin the address of your project
git push-u origin master
 
 
There’s going to be a problem here.


The reason is that when we created the warehouse on Github, we checked the default READme.md, which caused a mismatch between local and remote warehousing.
 
Solutions:
The Git pull origin master

 
And then git push-u Origin master
 
 
3. Push/Pull in IDEA
 
Right-click on the SRC or code file, Git — Repository — Push/Pull

 

How can IntelliJ idea completely delete a project

step1.
Use IDEA to open the project to be deleted, right-click on the project file and select Remove Module, or press Delete

step2.
A delete prompt will pop up, “Remove Module ‘XXX’ from the project?No files will be deleted. “
means that the specified module is removed, but No files have been deleted. That is, the module has been removed and the files on disk are still there

After clicking “OK”, you can see that there are still some files in the list, which are files outside of the module. The above deleted files are only the module of the project

step3.
You can right-click on the file and select Show in Explorer to quickly open the file on disk at the location
or you can manually find the project at the location on disk

After opening the disk directory, you can see that the project files are all there, one or more
IDEA deletion is logical deletion, files on the disk need to be deleted manually by yourself

step4.
Select the File menu of IDEA and select Close Project to Close the Project before manually deleting the File

The welcome home page of IDEA will then appear. Place the mouse over the item to be deleted, and you will see the “× delete” button in the upper right corner. Click delete

step5.
Finally, manually delete the project file on the disk, to this project file can be completely deleted clean!
be careful when manually deleting files on your disk to prevent the files from being unrecoverable.
is deleted in IDEA. If you still want it, you can open it again.

Idea startup prompt failed to create jvm: error code -1 jvm path solution


I modified ideA64. Exe. Vmoptions file of IDEA before, but when I restarted it prompted a problem similar to the above one, and deleted the parameters also prompted this one. Baidu searched for the solution, reloaded IDEA and reloaded JDK, but all of them failed to solve the problem.
This file does not have to exist, idea can still work without this file, but when custom parameters are needed, this file will be created for the first time.
Again this problem might as well delete C:\Users\ name \.IntelliJIdea2018.1\config vmoption file, simple and crude
 

Git Pull Failed solution

Git Pull Failed solution
https://blog.csdn.net/zxl1033394132/article/details/50853013?utm_source=blogxgwz0
https://www.cnblogs.com/daiyanren/p/9615698.html
The git server has changed
. Fix: when the modified code is ready to submit the code, the code changed by others in the group needs to be merged in first

git stash;
git pull;
git stash pop;

Conflicts are displayed, and if there are conflicts, manually modify them, and then commit the code


The idea of operating
git stash


git pull

git stash pop;


Merge conflicts

Finally
git commit/push