How to tell Maven to include the jar dependency, not the subproject source directory in Eclipse?

后端 未结 6 1468
情歌与酒
情歌与酒 2021-02-13 11:11

I use Apache Maven to manage my Java libs (jar) and some of projects that use the libs. For convinience, I use mvn eclipse:eclipse to generate Eclipse project f

6条回答
  •  天涯浪人
    2021-02-13 11:55

    Thanks for Hound Dog's hints. Yes, useProjectReferences controls Maven how to handle sub projects -- including source dir or including jar files.

    I haven't installed the maven plugin for Eclipse, so I add the following configuration in pom.xml. It tells Maven to include jar dependency in local maven repo, not the source dir. If the required jar file is not present in local repo, it will be automatically downloaded on the fly.

      
      
      org.apache.maven.plugins
        maven-eclipse-plugin
        2.9
        
                false
        
      
    

    Now mvn eclipse:eclipse works as expected.

提交回复
热议问题