简体   繁体   中英

After converting to maven getting error : Could not find or load main class

Suddenly I got an error when converting to maven. I create a simple java project, run main class, get results. After converting to maven - I got error : Could not find or load main class.

I tried deleting eclipse and its folder and download it again and get the same error. Do you know what can be the problem?

public class Main {

    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub
            System.out.println("Hello World");
    }

}

What I have noticed is that when I covert the project to maven, the maven did not create 'Maven Managed Dependencies'. Moreover I click on configure build path --> Add library --> Maven Managed Dependencies . and it does not add the folder.

应用树

Try this:

Right click on the project > Properties > Maven > Java EE Integration > Uncheck the option "Maven Archiver generates files under the build directory".

This should fix it. If it doesn't try Maven clean and install again.

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