Maven exec plugin- how to include “system” classpath?

后端 未结 4 700
情话喂你
情话喂你 2020-12-17 14:35

I have a project that uses \"system\" scope to specify a jar file included in my project\'s WEB-INF/lib dir. This artifact is not in any of the maven repositori

4条回答
  •  有刺的猬
    2020-12-17 15:18

    Interesting to know that classpathScope=system drops runtime dependencies. I found that by including it as a plugin in the pom.xml works as an alternative. Could you please try and let me know if it works for you too?

    So I added a system level dependency to commons-collection as an example like you have for your artifact:-

     
            commons-collections
          commons-collections
          3.0
            system
            C:\\\\commons-collections-3.0.jar
        
    

    Then in the tag I have the exec-maven-plugin plugin to be executed in the install phase:-

    
       org.codehaus.mojo
       exec-maven-plugin
       1.1
       
        
         install
         
          java
         
         
          com.stackoverflow.test.App
         
        
       
      
    

    Then I ran mvn install. I also made sure com.stackoverflow.test.App class has some code that invokes a class from commons-collections-3.0.

    Hope this helps.

提交回复
热议问题