【问题标题】:When using Maven Assembly Plugin - Manifest.MF is not packaged in the correct order使用 Maven 程序集插件时 - Manifest.MF 未按正确顺序打包
【发布时间】:2016-12-19 23:40:02
【问题描述】:
Failed to install artifact: C:\Test\7\config\analyzers\analyzers-7.0.0-13-SNAPSHOT-jar-with-dependencies.jar: org.osgi.framework.BundleException: The bundle file:/C:/Test/7/config/analyzers/analyzers-7.0.0-13-SNAPSHOT-jar-with-dependencies.jar does not have a META-INF/MANIFEST.MF! Make sure, META-INF and MANIFEST.MF are the first 2 entries in your JAR!
org.osgi.framework.BundleException: The bundle file:/C:/Palamida/7.0-v4/config/analyzers/analyzers-7.0.0-13-SNAPSHOT-jar-with-dependencies.jar does not have a META-INF/MANIFEST.MF! Make sure, META-INF and MANIFEST.MF are the first 2 entries in your JAR!
at org.apache.felix.fileinstall.internal.DirectoryWatcher.installOrUpdateBundle(DirectoryWatcher.java:1004)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:952)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:871)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:485)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:361)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:312)

错误的第一部分声称没有MANIFEST.MF,但手动检查发现它在那里。错误的第二部分声称MANIFEST.MF 不是我无法验证的 jar 中的前两个条目之一。我的程序集插件是否存在配置问题?

我的 pom.xml 包含我的 maven-assembly-plugin 配置:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-assembly-plugin</artifactId>
    <version>2.6</version>
    <configuration>
      <descriptorRefs>
        <descriptorRef>jar-with-dependencies</descriptorRef>
      </descriptorRefs>           
      <archive>
        <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>          
      </archive>
    </configuration>
    <executions>
      <execution>
        <phase>package</phase>
        <goals>
          <goal>single</goal>
        </goals>
      </execution>
    </executions>
</plugin>

我也在使用带有 manifest 目标的 maven-bundle-plugin,它输出一个 manifest.mf,它被 assembly-plugin 使用,但我认为这不会造成任何干扰。

【问题讨论】:

  • 我认为这应该是针对相应项目的错误报告。

标签: spring-mvc osgi maven-assembly-plugin apache-felix maven-bundle-plugin


【解决方案1】:
<plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>3.1.1</version>
            <configuration>
                <finalName>${name.project}</finalName>
                <archive>
                    <manifest>
                        <mainClass>br.com.car.view</mainClass>
                    </manifest>
                    <manifestFile>${basedir}/META-INF/MANIFEST.MF</manifestFile>
                </archive>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
                <appendAssemblyId>false</appendAssemblyId>
            </configuration>
            <executions>
                <execution>
                    <id>make-assembly</id>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

在你的 maven (pom) 配置文件中使用 manifest 命令文件的方法

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-25
    • 1970-01-01
    • 2010-11-07
    • 1970-01-01
    • 1970-01-01
    • 2022-06-29
    相关资源
    最近更新 更多