简体   繁体   中英

build error after importing maven projects

I cloned one of the open source git repositories and was trying to import it as maven project in eclipse. After I imported everything as a maven project, whole package is getting messed up. See the below error:

在此处输入图片说明

How can I fix this issue so that I can build it on my local box? I cloned the same git repository locally on my desktop.

I am using eclipse version:

Eclipse IDE for Java Developers

Version: Luna Service Release 1a (4.4.1)
Build id: 20150109-0600

Steps I have tried already:

  • I have already tried maven->update project .
  • I have also tried removing and adding it again.
  • I tried mvn clean install both on command line and eclipse, they are successful as well.

Can anyone help me with this? If needed, you can also clone it and try importing it to see whether it works for you or not.

The root of your problem is that the build section of the pom.xml for that project specifies:

<sourceDirectory>./src</sourceDirectory>

Eclipse uses the sourceDirectory tag to tell it where the root of the main sources are. If you change that to ./src/main/java , then right-click on the project > Maven > Update Project... and click Ok (I had to do this twice) it will fix the Eclipse classpath so Eclipse can build the project. You can then revert the pom back to the head revision and so long as you don't run Update Project again it should continue to build.

I'm unclear on why that project specifies a non-standard source directory but uses the standard Maven layout, but this should at least get you into a working state within Eclipse.

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