简体   繁体   中英

Error: Could not find or load main

i'm creating a SpringRoo Project in eclipse (STS), and run the project throw Error: Could not find or load main class src.main.java.com.ng.login.LogInApplication

My project directory

在此处输入图片说明


My Spring Roo Log File

jpa setup --provider HIBERNATE --database MYSQL 
entity jpa --class ~.domain.LogIn
field string --fieldName username --notNull --sizeMax 5
field string --fieldName password --notNull --sizeMax 5
repository jpa --entity ~.domain.LogIn --interface ~.respository.LogInRespository
service --entity ~.domain.LogIn --repository ~.respository.LogInRespository --interface ~.service.LogInService --class ~.service.impl.LogInServiceImpl
web mvc setup
web mvc view setup --type THYMELEAF
web mvc controller --controller ~.web.LoginController --entity ~.domain.LogIn --service ~.service.LogInService --responseType THYMELEAF
perform eclipse

Please Help me. I'm newbie in Spring Roo.

It seems your project hasn't been loaded correctly by STS, as it is using the src folder as part of the java package: src.main.java.com.ng.login. .

It would be interesting to know the Spring Roo version and the steps you have performed to generate the project and load it into the STS.

Anyway, when the STS Spring Roo plugin is used the project is created and loaded in STS automatically as explained in the reference guide , so I suppose you have created the project using the text console instead and then have imported the project in STS.

Also you have used the perform eclipse command, which is a way to call mvn eclipse:eclipse to generate the eclipse project. This command is deprecated, as nowadays the STS has support to load maven projects without using that utility.

If that's the case, try the following to solve the problem:

  1. Remove the project in STS. When the confirmation dialog is shown, don't check the Delete project contents on disk option.
  2. Look into your project root folder and delete any file or folder called .project , .settings or .classpath .
  3. Open the File menu and select Import
  4. In the Import dialog, open the Maven folder, select the Existing maven projects option and click Next
  5. Browse to the root folder of the created project.
  6. The pom.xml file of your project will appear, select it and then click the Finish button.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM