我目前正在关注教程。该项目包含一个父项目库 - 应用程序,包含3个模块(库模型,库资源,库int测试)。 处理library-int-tests时,maven构建过程失败。 这是抛出的异常。
13:54:02,028 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.deployment.unit."29b978cf-ba15-4c96-a470-9221d44850d1.war".STRUCTURE: org.jboss.msc.service.StartException in service jboss.deployment.unit."29b978cf-ba15-4c96-a470-9221d44850d1.war".STRUCTURE: JBAS018733: Failed to process phase STRUCTURE of deployment "29b978cf-ba15-4c96-a470-9221d44850d1.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:166) [wildfly-server-8.1.0.Final.jar:8.1.0.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_20]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_20]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_20]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS018741: Failed to get manifest for deployment "/content/29b978cf-ba15-4c96-a470-9221d44850d1.war/WEB-INF/lib/mockito-core-1.9.5.jar"
at org.jboss.as.server.deployment.module.ManifestAttachmentProcessor.getManifest(ManifestAttachmentProcessor.java:78) [wildfly-server-8.1.0.Final.jar:8.1.0.Final]
at org.jboss.as.server.deployment.module.ManifestAttachmentProcessor.deploy(ManifestAttachmentProcessor.java:65) [wildfly-server-8.1.0.Final.jar:8.1.0.Final]
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:159) [wildfly-server-8.1.0.Final.jar:8.1.0.Final]
... 5 more
Caused by: java.util.zip.ZipException: invalid LOC header (bad signature)
at java.util.zip.ZipFile.read(Native Method) [rt.jar:1.8.0_20]
at java.util.zip.ZipFile.access$1400(ZipFile.java:61) [rt.jar:1.8.0_20]
at java.util.zip.ZipFile$ZipFileInputStream.read(ZipFile.java:717) [rt.jar:1.8.0_20]
at java.util.zip.ZipFile$ZipFileInflaterInputStream.fill(ZipFile.java:420) [rt.jar:1.8.0_20]
at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158) [rt.jar:1.8.0_20]
at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:122) [rt.jar:1.8.0_20]
at org.jboss.vfs.util.PaddedManifestStream.read(PaddedManifestStream.java:43) [jboss-vfs-3.2.5.Final.jar:3.2.5.Final]
at java.io.InputStream.read(InputStream.java:170) [rt.jar:1.8.0_20]
at java.util.jar.Manifest$FastInputStream.fill(Manifest.java:441) [rt.jar:1.8.0_20]
at java.util.jar.Manifest$FastInputStream.readLine(Manifest.java:375) [rt.jar:1.8.0_20]
at java.util.jar.Manifest$FastInputStream.readLine(Manifest.java:409) [rt.jar:1.8.0_20]
at java.util.jar.Attributes.read(Attributes.java:376) [rt.jar:1.8.0_20]
at java.util.jar.Manifest.read(Manifest.java:199) [rt.jar:1.8.0_20]
at java.util.jar.Manifest.<init>(Manifest.java:69) [rt.jar:1.8.0_20]
at org.jboss.vfs.VFSUtils.readManifest(VFSUtils.java:224) [jboss-vfs-3.2.5.Final.jar:3.2.5.Final]
at org.jboss.vfs.VFSUtils.getManifest(VFSUtils.java:208) [jboss-vfs-3.2.5.Final.jar:3.2.5.Final]
at org.jboss.as.server.deployment.module.ManifestAttachmentProcessor.getManifest(ManifestAttachmentProcessor.java:76) [wildfly-server-8.1.0.Final.jar:8.1.0.Final]
... 7 more
所有模块的POM.xml文件如下。 library-app的pom.xml文件(父项目)
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.library</groupId>
<artifactId>library-app</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>JBoss repository</id>
<url>https://repository.jboss.org/nexus/content/groups/public-jboss</url>
</repository>
</repositories>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.9.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.5</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
<version>3.0.2.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.skyscreamer</groupId>
<artifactId>jsonassert</artifactId>
<version>1.2.3</version>
<scope>test</scope>
</dependency>
<!-- Our library-model src and test jars are below -->
<dependency>
<groupId>com.library</groupId>
<artifactId>library-model</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.library</groupId>
<artifactId>library-model</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
</dependency>
<!-- Our library-model src and test jars are abve -->
<!-- Our library-resource src and test jars are below -->
<dependency>
<groupId>com.library</groupId>
<artifactId>library-resource</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.library</groupId>
<artifactId>library-resource</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
</dependency>
<!-- Our library-resource src and test jars are abve -->
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.7</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<!-- <dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.1.0-RC.1</version>
<type>pom</type>
</dependency>
-->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mockito/mockito-all -->
<!-- <dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.10.19</version>
</dependency> -->
<!-- https://mvnrepository.com/artifact/org.hamcrest/hamcrest-all -->
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>2.2.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>javax.el</artifactId>
<version>2.2.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.6.4</version>
<scope>test</scope>
</dependency>
</dependencies>
<modules>
<module>library-model</module>
<module>library-resource</module>
<module>library-int-tests</module>
</modules>
</project>
library-int-test的pom.xml文件
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.library</groupId>
<artifactId>library-app</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>library-int-tests</artifactId>
<properties>
<version.arquillian_core>1.1.5.Final</version.arquillian_core>
<version.arquillian.wildfly>8.1.0.Final</version.arquillian.wildfly>
</properties>
<dependencies>
<dependency>
<groupId>com.library</groupId>
<artifactId>library-model</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.library</groupId>
<artifactId>library-model</artifactId>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.library</groupId>
<artifactId>library-resource</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.library</groupId>
<artifactId>library-resource</artifactId>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.skyscreamer</groupId>
<artifactId>jsonassert</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>skip-int-tests</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>default-testCompile</id>
<phase>test-compile</phase>
<configuration>
<testExcludes>
<exclude>**/*.java</exclude>
</testExcludes>
</configuration>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>integrationTests-wildfly</id>
<properties>
<jboss.home>target/wildfly-8.1.0.Final</jboss.home>
</properties>
<build>
<testResources>
<testResource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>default-testCompile</id>
<phase>test-compile</phase>
<configuration>
<testIncludes>
<include>**/*.java</include>
</testIncludes>
</configuration>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/*IntTest.java</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack</id>
<phase>generate-sources</phase>
<goals>
<goal>unpack</goal>
</goals>
</execution>
</executions>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-dist</artifactId>
<version>${version.arquillian.wildfly}</version>
<type>zip</type>
<overWrite>false</overWrite>
<outputDirectory>target</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-resources</id>
<phase>process-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${jboss.home}/standalone/configuration</outputDirectory>
<resources>
<resource>
<directory>src/test/resources/</directory>
<includes>
<include>standalone-full.xml</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-bom</artifactId>
<version>2.2.0-beta-1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>${version.arquillian_core}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian.core</groupId>
<artifactId>arquillian-core-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-arquillian-container-managed</artifactId>
<version>${version.arquillian.wildfly}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-impl-maven</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-7.0</artifactId>
<version>1.0.0.Final</version>
<type>pom</type>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
</profiles>
库模型的pom.xml文件
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.library</groupId>
<artifactId>library-app</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>library-model</artifactId>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<!-- used for testing phase only for runtime we will use postgresql -->
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.3.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.3.7.Final</version>
<scope>test</scope>
</dependency>
<!-- This hibernate-validator dependency is commented because of validationException.
So, below 4.3.2 validation was brought <dependency> <groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId> <version>5.1.3.Final</version>
<scope>test</scope> </dependency> -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.3.2.Final</version>
</dependency>
</dependencies>
</project>
,最后是library-resource的pom.xml文件
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.library</groupId>
<artifactId>library-app</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>library-resource</artifactId>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.library</groupId>
<artifactId>library-model</artifactId>
</dependency>
<dependency>
<groupId>com.library</groupId>
<artifactId>library-model</artifactId>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.skyscreamer</groupId>
<artifactId>jsonassert</artifactId>
<scope>test</scope>
</dependency>
<!-- Our library-model src and test jars are abve -->
</dependencies>
</project>
我正在使用wildfly 8.1。该错误显示有关mockito的内容。我不明白。请帮我解决这个问题。
编辑:错误和警告日志很大。我想将完整输出托管到pastebin但由于大小限制而无法完成。我在这里托管了部分输出http://pastebin.com/S2cSaPBt
答案 0 :(得分:0)
看起来你有一个损坏的mockito-core-1.9.5.jar
库。您可能希望尝试从本地存储库中删除JAR并重建应用程序。