How to add a local non-maven project as a dependency for a maven project?

后端 未结 3 1190
难免孤独
难免孤独 2020-12-21 04:36

I created a new Spring web app, and I\'d very much like to use Maven to handle builds/dependencies. My problem is that the project depends on some existing local projects,

3条回答
  •  清酒与你
    2020-12-21 05:22

    This answer's a tad late but just in case somebody needs it, I found the solution using Maven's Build Helper Plugin, that is if you don't want deploying your non-maven project as a jar:

    So basically you just add the source directory of the non-maven project in the tag:

    
        org.codehaus.mojo
        build-helper-maven-plugin
        3.0.0
        
            
                add-source
                generate-sources
                
                    add-source
                
                
                    
                        C:\Users\user123\eclipse-workspace\my_non_maven_project\src
                    
                
            
        
    
    

    Now if that non-maven project has dependencies of its own, you need to add them in the section of your maven project as well.

提交回复
热议问题