Различие в версии, выбранной maven-assembly-plugin и maven-bundle-plugin - PullRequest
0 голосов
/ 11 декабря 2018

Существует различие в jar-файлах, генерируемых maven-bundle-plugin и maven-assembly-plugin.В частности, выбранная версия bouncycastle - 1.54 подключаемым плагином, в то время как версия, собранная подключаемым плагином - 1.6.

Вот как я проверил наблюдение: - я явно добавил зависимость для bouncy castle (с версией 1.6) в файле POM.Созданные банки одинаковы, но не иначе.(все зависимости обрабатываются автоматически, в обоих банках проблем нет)

Дерево зависимостей выглядит следующим образом

[INFO] com.psg.dis.analysis:UnstructuredDataAnalyzer:bundle:9.9.0-SNAPSHOT
[INFO] +- com.psg.dis.platform:IDAPlatform:jar:9.9.0-SNAPSHOT:provided
[INFO] |  +- com.psg.dis.platform:Common:jar:9.9.0-SNAPSHOT:provided
[INFO] |  |  +- com.psg.dis.platform:Policies:jar:9.9.0-SNAPSHOT:provided
[INFO] |  |  |  \- com.psg.services.policies:policies-common:jar:1.0.1:provided
[INFO] |  |  |     \- com.psg.services.policies:policies-client-inf:jar:1.0.1:provided
[INFO] |  |  |        +- com.psg.services.sdk:common-predef:jar:1.0.1:provided
[INFO] |  |  |        +- com.psg.services.sdk:common-api:jar:1.0.1:provided
[INFO] |  |  |        \- com.psg.services.dps:dps-client-inf:jar:1.0.1:provided
[INFO] |  |  |           \- io.projectreactor:reactor-core:jar:3.1.8.RELEASE:provided
[INFO] |  |  |              \- org.reactivestreams:reactive-streams:jar:1.0.2:provided
[INFO] |  |  +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:jar:2.9.3:provided
[INFO] |  |  |  +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:jar:2.9.3:provided
[INFO] |  |  |  \- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.9.3:provided
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jsr353:jar:2.9.3:provided
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.9.3:provided
[INFO] |  |  +- org.glassfish:javax.json:jar:1.1.2:provided
[INFO] |  |  +- javax.json:javax.json-api:jar:1.1.2:provided
[INFO] |  |  +- javax.ws.rs:javax.ws.rs-api:jar:2.1:provided
[INFO] |  |  +- org.apache.logging.log4j:log4j-api:jar:2.11.0:provided
[INFO] |  |  +- org.apache.logging.log4j:log4j-core:jar:2.11.0:provided
[INFO] |  |  +- org.apache.logging.log4j:log4j-jul:jar:2.11.0:provided
[INFO] |  |  +- org.apache.logging.log4j:log4j-slf4j-impl:jar:2.11.0:provided
[INFO] |  |  +- org.glassfish.jersey.inject:jersey-hk2:jar:2.26:provided
[INFO] |  |  |  \- org.glassfish.hk2:hk2-locator:jar:2.5.0-b42:provided
[INFO] |  |  |     +- org.glassfish.hk2.external:aopalliance-repackaged:jar:2.5.0-b42:provided
[INFO] |  |  |     +- org.glassfish.hk2:hk2-api:jar:2.5.0-b42:provided
[INFO] |  |  |     |  \- javax.inject:javax.inject:jar:1:provided
[INFO] |  |  |     \- org.glassfish.hk2:hk2-utils:jar:2.5.0-b42:provided
[INFO] |  |  +- commons-cli:commons-cli:jar:1.3.1:provided
[INFO] |  |  +- org.apache.commons:commons-lang3:jar:3.4:provided
[INFO] |  |  +- org.glassfish.grizzly:grizzly-http-server:jar:2.4.2:provided
[INFO] |  |  |  \- org.glassfish.grizzly:grizzly-http:jar:2.4.2:provided
[INFO] |  |  |     \- org.glassfish.grizzly:grizzly-framework:jar:2.4.2:provided
[INFO] |  |  +- org.glassfish.grizzly:grizzly-http-servlet:jar:2.4.2:provided
[INFO] |  |  +- org.bouncycastle:bcpkix-jdk15on:jar:1.56:compile

pom файл выглядит следующим образом: -

<?xml version="1.0"?>
<project
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
    xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.psg.dis.analysis</groupId>
        <artifactId>Analysis-Parent</artifactId>
        <version>9.9.0-SNAPSHOT</version>
    </parent>
    <artifactId>UnstructuredDataAnalyzer</artifactId>

    <packaging>bundle</packaging>

    <dependencies>
        <dependency>
            <groupId>com.psg.dis.platform</groupId>
            <artifactId>IDAPlatform</artifactId>
            <version>${platformVersion}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.service.component.annotations</artifactId>
            <version>1.3.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.psg.dis.analysis</groupId>
            <artifactId>IDANode</artifactId>
            <version>${platformVersion}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.tika</groupId>
            <artifactId>tika-core</artifactId>
            <version>1.18</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tika</groupId>
            <artifactId>tika-langdetect</artifactId>
            <version>1.18</version>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.cxf</groupId>
                    <artifactId>cxf-rt-rs-client</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.tika</groupId>
            <artifactId>tika-parsers</artifactId>
            <version>1.18</version>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.cxf</groupId>
                    <artifactId>cxf-rt-rs-client</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.25</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.17</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-scratchpad</artifactId>
            <version>3.17</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml-schemas</artifactId>
            <version>3.17</version>
        </dependency>
        <dependency>
            <groupId>org.apache.lucene</groupId>
            <artifactId>lucene-core</artifactId>
            <version>7.3.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.lucene</groupId>
            <artifactId>lucene-analyzers-common</artifactId>
            <version>7.3.1</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <annotationProcessors>
                        <annotationProcessor>
                            com.psg.dis.analysis.util.PluginAnnotationProcessor
                        </annotationProcessor>
                    </annotationProcessors>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>3.5.0</version>
                <extensions>true</extensions>
                <executions>
                    <execution>
                        <id>bundle-manifest</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>manifest</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <manifestLocation>${project.build.outputDirectory}/META-INF/</manifestLocation> <!-- make sure this is present! in the example of maven bundle plugin documentation, 
                        this piece is NOT present -->
                    <exportScr>true</exportScr> <!-- be sure to add this line as well -->
                    <supportedProjectTypes>
                        <supportedProjectType>jar</supportedProjectType>
                        <supportedProjectType>bundle</supportedProjectType>
                        <supportedProjectType>war</supportedProjectType>
                    </supportedProjectTypes>
                    <instructions>
                        <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
                        <_dsannotations>*</_dsannotations>
                        <_dsannotations-options>version;minimum=1.0.0</_dsannotations-options>
                        <!-- we explicitly import the interfaces package, not the implementations, 
                            otherwise we get into dependency and version hell -->
                        <Import-Package>com.psg.dis.common.extensions.interfaces;version=${platformVersion},com.psg.dis.analysis.common.interfaces;version=${platformVersion},javax.json,javax.ws.rs.client</Import-Package>
                        <Build-Timestamp> ${maven.build.timestamp}</Build-Timestamp>
                        <Include-Resource>{maven-resources},{maven-dependencies},schemes=target/classes/schemes</Include-Resource><!-- 
                            override schemes with the one generated by the processor -->
                            <Embed-Dependency>*;scope=compile;type=!pom;inline=true;type=!java</Embed-Dependency>
                            <Embed-Transitive>true</Embed-Transitive>
                    </instructions>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>3.0.0</version>
                <configuration>
                    <appendAssemblyId>true</appendAssemblyId>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                    <archive>
                        <manifestFile>target/classes/META-INF/MANIFEST.MF</manifestFile>
                    </archive>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id> this is used for inheritance merges
                        <phase>package</phase> bind to the packaging phase
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>Build Test</id>
            <activation>
                <property>
                    <name>!maven.test.skip</name>
                </property>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>com.psg.dis.analysis</groupId>
                    <artifactId>IDANode</artifactId>
                    <type>test-jar</type>
                    <version>${platformVersion}</version>
                    <scope>test</scope>
                </dependency>
            </dependencies>
        </profile>
    </profiles>
</project>

Спасибо за помощь

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...