简体   繁体   中英

Set custom classpath maven-jar-plugin

I want to add custom classpath to manifest file of my project. The classpath should point to all the files within a particular directory(lib). Something like lib/. or lib/* Have tried specifying in entry to manifestEntries of maven-jar-plugin configuration but it doesn't seem to work. Kindly recommend how to do it ?

UPDATE

What I want is something like this-

<manifestEntries>
<Class-Path>lib*</Class-Path>
</manifestEntries>

I want to add all the jars present in the lib directory even though they may not be project's dependencies.

I think the following worked for me sometime back using classpathPrefix

<plugin>
    <artifactId>maven-jar-plugin</artifactId>
    <version>2.3</version>
    <configuration>
      <archive>
        <manifest>
          <addClasspath>true</addClasspath>
          <classpathPrefix>lib/</classpathPrefix>
          <classpathLayoutType>repository</classpathLayoutType>
        </manifest>
      </archive>
    </configuration>
  </plugin>

Original link: maven-jar-plugin

Maybe your lib folder is not inside the generate jar file?.I am not sure if that can help you. But you can include or exclude content in your jar file. Have a look here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM