Maven NullpointerException на этапе упаковки с распаковкой zip для XML-схем - PullRequest
0 голосов
/ 02 мая 2018

У меня есть проект, который должен включать схемы XML из другого проекта.

Исходный проект создает zip-файл ~/.m2/repository/com/comp/xml-schemas/0.0.1-SNAPSHOT/xml-schemas-0.0.1-SNAPSHOT-resources.zip вместе с jar-файлом xml-schemas-0.0.1-SNAPSHOT.jar

В pom проекта с использованием xml-схем я использовал плагин зависимостей для импорта схем xml.

<?xml version="1.0" encoding="UTF-8"?>
<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>
    <artifactId>core.xml-schemas</artifactId>
    <packaging>bwmodule</packaging>
    <parent>
        <groupId>com.comp.bw</groupId>
        <artifactId>core.parent</artifactId>
        <version>1.0.0-SNAPSHOT</version>
        <relativePath>../core.parent</relativePath>
    </parent>
    <dependencies>
        <dependency>
            <groupId>com.comp</groupId>
            <artifactId>xml-schemas</artifactId>
            <version>0.0.1-SNAPSHOT</version>
            <classifier>resources</classifier>
            <type>zip</type>
        </dependency>
    </dependencies>
    <build>
        <sourceDirectory>src</sourceDirectory>
        <outputDirectory>target/classes</outputDirectory>
        <plugins>
            <plugin>
                <groupId>com.tibco.plugins</groupId>
                <artifactId>bw6-maven-plugin</artifactId>
                <version>1.3.1</version>
                <extensions>true</extensions>
            </plugin>
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>unpack-dependencies</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>com.comp</groupId>
                                    <artifactId>xml-schemas</artifactId>
                                    <version>0.0.1-SNAPSHOT</version>
                                    <classifier>resources</classifier>
                                    <type>zip</type>
                                </artifactItem>
                            </artifactItems>
                            <includes>**/*.x*</includes>
                            <includeGroupIds>com.comp</includeGroupIds>
                            <includeArtifactIds>xml-schemas</includeArtifactIds>
                            <outputDirectory>${project.basedir}/Schemas</outputDirectory>
                            <includeTransative>true</includeTransative>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-clean-plugin</artifactId>
                <version>3.0.0</version>
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>Schemas</directory>
                            <includes>
                                <include>**/*</include>
                            </includes>
                            <followSymlinks>false</followSymlinks>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

Когда у меня run mvn validate и mvn compile, все отлично работает. Также, когда я запускаю Update project в Eclipse, нет проблем.

Но когда я запускаю mvn package, выдается сообщение об ошибке:

[johan@localhost core.xml-schemas]$ mvn clean package -e
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] Starting Maven Build for BW6 Project.................................
[INFO] Checking for In-Project JAR dependencies if any and Pushing them to Local Maven Repository
[INFO] 
[INFO] -----------------< com.comp.bw:core.xml-schemas >------------------
[INFO] Building core.xml-schemas 1.0.0-SNAPSHOT
[INFO] ------------------------------[ bwmodule ]------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) @ core.xml-schemas ---
[INFO] Deleting /home/johan/projects/bw6_projects/core.xml-schemas/target
[INFO] Deleting /home/johan/projects/bw6_projects/core.xml-schemas/Schemas (includes = [**/*], excludes = [])
[INFO] 
[INFO] --- maven-dependency-plugin:2.8:unpack-dependencies (default) @ core.xml-schemas ---
[INFO] Unpacking /home/johan/.m2/repository/com/comp/xml-schemas/0.0.1-SNAPSHOT/xml-schemas-0.0.1-SNAPSHOT-resources.zip to /home/johan/projects/bw6_projects/core.xml-schemas/Schemas with includes "**/*.x*" and excludes ""
[INFO] 
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ core.xml-schemas ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/johan/projects/bw6_projects/core.xml-schemas/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ core.xml-schemas ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ core.xml-schemas ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/johan/projects/bw6_projects/core.xml-schemas/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.7.0:testCompile (default-testCompile) @ core.xml-schemas ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.21.0:test (default-test) @ core.xml-schemas ---
[INFO] No tests to run.
[INFO] 
[INFO] --- bw6-maven-plugin:1.3.1:bwmodule (default-bwmodule) @ core.xml-schemas ---
[INFO] Module Packager Mojo started for Module core.xml-schemas ...
[INFO] Updated the Manifest version 
UpdateManifest Method in
Update Attribute
[INFO] The OSGi verion is 1.0.0.201805020939 for Maven version of 1.0.0.201805020939
[INFO] Removing the externals entries if any. 
[INFO] Created Plugin JAR with name /home/johan/projects/bw6_projects/core.xml-schemas/target/core.xml-schemas_1.0.0.201805020939.jar
[INFO] Adding Maven Dependencies to the Plugin JAR file
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.556 s
[INFO] Finished at: 2018-05-02T09:39:06+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.tibco.plugins:bw6-maven-plugin:1.3.1:bwmodule (default-bwmodule) on project core.xml-schemas: Execution default-bwmodule of goal com.tibco.plugins:bw6-maven-plugin:1.3.1:bwmodule failed.: NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.tibco.plugins:bw6-maven-plugin:1.3.1:bwmodule (default-bwmodule) on project core.xml-schemas: Execution default-bwmodule of goal com.tibco.plugins:bw6-maven-plugin:1.3.1:bwmodule failed.
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-bwmodule of goal com.tibco.plugins:bw6-maven-plugin:1.3.1:bwmodule failed.
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:148)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: java.lang.NullPointerException
    at com.tibco.bw.maven.plugin.module.BWModulePackageMojo.addDependencies (BWModulePackageMojo.java:188)
    at com.tibco.bw.maven.plugin.module.BWModulePackageMojo.execute (BWModulePackageMojo.java:110)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
[ERROR] 
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

Может ли кто-нибудь помочь мне с этим?

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