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

后端 未结 6 1458
情歌与酒
情歌与酒 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:44

    I believe this is actually because they're related projects in Eclipse. So if you right-click on your main project and go to Project References your lib project should be ticked.

    If you run mvn eclipse:eclipse it will automatically add project references for any sub-projects (modules). You can change this with the useProjectReferences property of the maven eclipse plugin.

    It defaults to true, but

    When set to false, the plugin will not create sub-projects and instead reference those sub-projects using the installed package in the local repository

    To use the property either set the property in your pom.xml

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

    Or as a property on the command line:

    mvn eclipse:eclipse -Declipse.useProjectReferences=false
    

提交回复
热议问题