maven add a local classes directory to module's classpath

前端 未结 1 878
没有蜡笔的小新
没有蜡笔的小新 2021-01-07 05:28

I know this is a bit out of maven\'s scope, but I need to add a local directory with compiled classes to the module\'s classpath. I saw: Maven: add a folder or jar file into

1条回答
  •  旧时难觅i
    2021-01-07 06:05

    After some extensive research, I found that my best option was to use the maven-antrun-plugin and during the process-resources phase, generate a jar from the classes and add it as dependency with system scope and systemPath to the jar I just built.

    Pom snippets:

    
    org.apache.maven.plugins
    maven-antrun-plugin
    1.6
    
        
            process-resources
            
                run
            
            
                
                    
    
                    
                        
                        
                            
                                
                                    
                                
                            
                        
                        
                            
                        
                    
                
            
        
    
    

    ....

        
            ant-contrib
            ant-contrib
            1.0b3
        
        
            com.my.code
            classes.jar
            1.1
            system
            ${env.TEMP}\classes.jar
        
    

    0 讨论(0)
提交回复
热议问题