简体   繁体   English

设置自定义类路径maven-jar-plugin

[英]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). 类路径应指向特定目录(lib)中的所有文件。 Something like lib/. 类似于lib/. or lib/* Have tried specifying in entry to manifestEntries of maven-jar-plugin configuration but it doesn't seem to work. lib/*曾尝试在maven-jar-plugin配置的manifestEntries条目中指定,但似乎不起作用。 Kindly recommend how to do it ? 请推荐该怎么做?

UPDATE 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. 我想添加lib目录中存在的所有jar,即使它们可能不是项目的依赖项也是如此。

I think the following worked for me sometime back using classpathPrefix 我认为以下某些时候使用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 原始链接: maven-jar-plugin

Maybe your lib folder is not inside the generate jar file?.I am not sure if that can help you. 也许您的lib文件夹不在生成jar文件中?。我不确定是否可以帮助您。 But you can include or exclude content in your jar file. 但是您可以在jar文件中包含或排除内容。 Have a look here 在这里看看

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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