gpt4 book ai didi

java - Jacoco 从未调用过 "mvn install"。手动触发时(("mvn jacoco:report"),表示执行数据文件丢失

转载 作者:行者123 更新时间:2023-11-30 05:22:06 27 4
gpt4 key购买 nike

问题

我无法让 Jacoco 正常运行( jacoco.exec 从未创建):

  1. mvn install ,仅 surefire叫做。 jacoco插件甚至从未被调用(它出现在日志中的任何地方)。
  2. mvn jacoco:report ,然后我得到 [INFO] Skipping JaCoCo execution due to missing execution data file. .

我看过的所有解决方案都谈到:

  1. 如何 surefire将覆盖 argLine Jacoco 的论点,但我没有在我的 pom 中使用任何 argLine .
  2. prepare-agent缺乏目标(但我有)。
<小时/>

pom.xml

这是我完整的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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.bob.blob</groupId>
<artifactId>blah</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Blah</name>
<description>Blabla</description>
<packaging>war</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.2.RELEASE</version>
</parent>

<properties>
<java.version>11</java.version> <!-- For SpringBoot : sets `maven.compiler` properties -->
<junit-jupiter-engine.version>5.5.2</junit-jupiter-engine.version>
<junit-platform-surefire-provider.version>1.3.2</junit-platform-surefire-provider.version>
<jacoco-maven-plugin.version>0.8.5</jacoco-maven-plugin.version>
<bullhorn-sdk-rest.version>1.2.48</bullhorn-sdk-rest.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
</dependency>
<!-- Used for the proper config of Redis. -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
<!-- todo: remove duplicated JSONObject.class ?
see: https://stackoverflow.com/a/52980523/9768291 -->
<!-- <exclusion>-->
<!-- <groupId>com.vaadin.external.google</groupId>-->
<!-- <artifactId>android-json</artifactId>-->
<!-- </exclusion>-->
</exclusions>
</dependency>

<!-- Bullhorn Rest SDK Java : https://github.com/bullhorn/sdk-rest -->
<dependency>
<groupId>com.bullhorn</groupId>
<artifactId>sdk-rest</artifactId>
<version>${bullhorn-sdk-rest.version}</version>
</dependency>
<!-- Dependency used in Bullhorn Rest SDK, removed in Java 11.
Solution from : https://stackoverflow.com/a/47412779/9768291 -->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</dependency>
</dependencies>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<warSourceDirectory>src/main/webapp</warSourceDirectory>
<warName>ROOT</warName>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>

<!-- Surefire: used for unit tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<dependencies>
<!-- todo: remove this deprecated dependency?
see: https://github.com/junit-team/junit5-samples/blob/r5.5.2/junit5-jupiter-starter-maven/pom.xml -->
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>${junit-platform-surefire-provider.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit-jupiter-engine.version}</version>
</dependency>
</dependencies>
</plugin>

<!-- Jacoco: Test coverage reports (for SonarQube) -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco-maven-plugin.version}</version>
<executions>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<!-- Trying to get the report to be created on simple unit tests too. -->
<execution>
<id>default-unit-test-report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<!-- Overwrite unit test results once the integration tests are done. -->
<execution>
<id>default-integration-test-report</id>
<phase>post-integration-test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<finalName>ROOT</finalName>
</build>
</project>
<小时/>

Debug模式

这是输入 mvn jacoco:report -debug 的结果:

Apache Maven 3.6.2 (40f52333136460af0dc0d7232c0dc0bcf0d9e117; 2019-08-27T11:06:16-04:00)
Maven home: C:\Users\bob\apache-maven-3.6.2\bin\..
Java version: 12, vendor: Oracle Corporation, runtime: C:\Users\bob\jdk-12
Default locale: en_CA, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
[DEBUG] Created new class realm maven.api
[DEBUG] Importing foreign packages into class realm maven.api
[DEBUG] Imported: javax.annotation.* < plexus.core
[DEBUG] Imported: javax.annotation.security.* < plexus.core
[DEBUG] Imported: javax.enterprise.inject.* < plexus.core
[DEBUG] Imported: javax.enterprise.util.* < plexus.core
[DEBUG] Imported: javax.inject.* < plexus.core
[DEBUG] Imported: org.apache.maven.* < plexus.core
[DEBUG] Imported: org.apache.maven.artifact < plexus.core
[DEBUG] Imported: org.apache.maven.classrealm < plexus.core
[DEBUG] Imported: org.apache.maven.cli < plexus.core
[DEBUG] Imported: org.apache.maven.configuration < plexus.core
[DEBUG] Imported: org.apache.maven.exception < plexus.core
[DEBUG] Imported: org.apache.maven.execution < plexus.core
[DEBUG] Imported: org.apache.maven.execution.scope < plexus.core
[DEBUG] Imported: org.apache.maven.lifecycle < plexus.core
[DEBUG] Imported: org.apache.maven.model < plexus.core
[DEBUG] Imported: org.apache.maven.monitor < plexus.core
[DEBUG] Imported: org.apache.maven.plugin < plexus.core
[DEBUG] Imported: org.apache.maven.profiles < plexus.core
[DEBUG] Imported: org.apache.maven.project < plexus.core
[DEBUG] Imported: org.apache.maven.reporting < plexus.core
[DEBUG] Imported: org.apache.maven.repository < plexus.core
[DEBUG] Imported: org.apache.maven.rtinfo < plexus.core
[DEBUG] Imported: org.apache.maven.settings < plexus.core
[DEBUG] Imported: org.apache.maven.toolchain < plexus.core
[DEBUG] Imported: org.apache.maven.usability < plexus.core
[DEBUG] Imported: org.apache.maven.wagon.* < plexus.core
[DEBUG] Imported: org.apache.maven.wagon.authentication < plexus.core
[DEBUG] Imported: org.apache.maven.wagon.authorization < plexus.core
[DEBUG] Imported: org.apache.maven.wagon.events < plexus.core
[DEBUG] Imported: org.apache.maven.wagon.observers < plexus.core
[DEBUG] Imported: org.apache.maven.wagon.proxy < plexus.core
[DEBUG] Imported: org.apache.maven.wagon.repository < plexus.core
[DEBUG] Imported: org.apache.maven.wagon.resource < plexus.core
[DEBUG] Imported: org.codehaus.classworlds < plexus.core
[DEBUG] Imported: org.codehaus.plexus.* < plexus.core
[DEBUG] Imported: org.codehaus.plexus.classworlds < plexus.core
[DEBUG] Imported: org.codehaus.plexus.component < plexus.core
[DEBUG] Imported: org.codehaus.plexus.configuration < plexus.core
[DEBUG] Imported: org.codehaus.plexus.container < plexus.core
[DEBUG] Imported: org.codehaus.plexus.context < plexus.core
[DEBUG] Imported: org.codehaus.plexus.lifecycle < plexus.core
[DEBUG] Imported: org.codehaus.plexus.logging < plexus.core
[DEBUG] Imported: org.codehaus.plexus.personality < plexus.core
[DEBUG] Imported: org.codehaus.plexus.util.xml.Xpp3Dom < plexus.core
[DEBUG] Imported: org.codehaus.plexus.util.xml.pull.XmlPullParser < plexus.core
[DEBUG] Imported: org.codehaus.plexus.util.xml.pull.XmlPullParserException < plexus.core
[DEBUG] Imported: org.codehaus.plexus.util.xml.pull.XmlSerializer < plexus.core
[DEBUG] Imported: org.eclipse.aether.* < plexus.core
[DEBUG] Imported: org.eclipse.aether.artifact < plexus.core
[DEBUG] Imported: org.eclipse.aether.collection < plexus.core
[DEBUG] Imported: org.eclipse.aether.deployment < plexus.core
[DEBUG] Imported: org.eclipse.aether.graph < plexus.core
[DEBUG] Imported: org.eclipse.aether.impl < plexus.core
[DEBUG] Imported: org.eclipse.aether.installation < plexus.core
[DEBUG] Imported: org.eclipse.aether.internal.impl < plexus.core
[DEBUG] Imported: org.eclipse.aether.metadata < plexus.core
[DEBUG] Imported: org.eclipse.aether.repository < plexus.core
[DEBUG] Imported: org.eclipse.aether.resolution < plexus.core
[DEBUG] Imported: org.eclipse.aether.spi < plexus.core
[DEBUG] Imported: org.eclipse.aether.transfer < plexus.core
[DEBUG] Imported: org.eclipse.aether.version < plexus.core
[DEBUG] Imported: org.fusesource.jansi.* < plexus.core
[DEBUG] Imported: org.slf4j.* < plexus.core
[DEBUG] Imported: org.slf4j.event.* < plexus.core
[DEBUG] Imported: org.slf4j.helpers.* < plexus.core
[DEBUG] Imported: org.slf4j.spi.* < plexus.core
[DEBUG] Populating class realm maven.api
[INFO] Error stacktraces are turned on.
[DEBUG] Message scheme: color
[DEBUG] Message styles: debug info warning error success failure strong mojo project
[DEBUG] Reading global settings from C:\Users\bob\apache-maven-3.6.2\bin\..\conf\settings.xml
[DEBUG] Reading user settings from C:\Users\bob\.m2\settings.xml
[DEBUG] Reading global toolchains from C:\Users\bob\apache-maven-3.6.2\bin\..\conf\toolchains.xml
[DEBUG] Reading user toolchains from C:\Users\bob\.m2\toolchains.xml
[DEBUG] Using local repository at C:\Users\bob\.m2\repository
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10.0 for C:\Users\bob\.m2\repository
[INFO] Scanning for projects...
[DEBUG] Extension realms for project com.bob.blob:blah:war:0.0.1-SNAPSHOT: (none)
[DEBUG] Looking up lifecycle mappings for packaging war from ClassRealm[plexus.core, parent: null]
[DEBUG] Extension realms for project org.springframework.boot:spring-boot-starter-parent:pom:2.2.2.RELEASE: (none)
[DEBUG] Looking up lifecycle mappings for packaging pom from ClassRealm[plexus.core, parent: null]
[DEBUG] Extension realms for project org.springframework.boot:spring-boot-dependencies:pom:2.2.2.RELEASE: (none)
[DEBUG] Looking up lifecycle mappings for packaging pom from ClassRealm[plexus.core, parent: null]
[DEBUG] Resolving plugin prefix jacoco from [org.apache.maven.plugins, org.codehaus.mojo]
[DEBUG] Resolved plugin prefix jacoco to org.jacoco:jacoco-maven-plugin from POM com.bob.blob:blah:war:0.0.1-SNAPSHOT
[DEBUG] === REACTOR BUILD PLAN ================================================
[DEBUG] Project: com.bob.blob:blah:war:0.0.1-SNAPSHOT
[DEBUG] Tasks: [jacoco:report]
[DEBUG] Style: Regular
[DEBUG] =======================================================================
[INFO]
[INFO] ------------------< com.bob.blob:blah >------------------
[INFO] Building Blah 0.0.1-SNAPSHOT
[INFO] --------------------------------[ war ]---------------------------------
[DEBUG] Resolving plugin prefix jacoco from [org.apache.maven.plugins, org.codehaus.mojo]
[DEBUG] Resolved plugin prefix jacoco to org.jacoco:jacoco-maven-plugin from POM com.bob.blob:blah:war:0.0.1-SNAPSHOT
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sou
rces, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, in
tegration-test, post-integration-test, verify, install, deploy]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[DEBUG] === PROJECT BUILD PLAN ================================================
[DEBUG] Project: com.bob.blob:blah:0.0.1-SNAPSHOT
[DEBUG] Dependencies (collect): []
[DEBUG] Dependencies (resolve): []
[DEBUG] Repositories (dependencies): [central (https://repo.maven.apache.org/maven2, default, releases)]
[DEBUG] Repositories (plugins) : [central (https://repo.maven.apache.org/maven2, default, releases)]
[DEBUG] -----------------------------------------------------------------------
[DEBUG] Goal: org.jacoco:jacoco-maven-plugin:0.8.5:report (default-cli)
[DEBUG] Style: Regular
[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
<dataFile default-value="${project.build.directory}/jacoco.exec">${jacoco.dataFile}</dataFile>
<outputDirectory default-value="${project.reporting.outputDirectory}/jacoco"/>
<outputEncoding default-value="UTF-8">${project.reporting.outputEncoding}</outputEncoding>
<project>${project}</project>
<skip default-value="false">${jacoco.skip}</skip>
<sourceEncoding default-value="UTF-8">${project.build.sourceEncoding}</sourceEncoding>
<title default-value="${project.name}"/>
</configuration>
[DEBUG] =======================================================================
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.5:report (default-cli) @ blah ---
[DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=1757500, ConflictMarker.markTime=465700, ConflictMarker.nodeCount=185, ConflictIdSorter.graphTime=842400
, ConflictIdSorter.topsortTime=511300, ConflictIdSorter.conflictIdCount=63, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=9004400, ConflictResolver
.conflictItemCount=154, DefaultDependencyCollector.collectTime=610516900, DefaultDependencyCollector.transformTime=14868300}
[DEBUG] org.jacoco:jacoco-maven-plugin:jar:0.8.5
[DEBUG] org.apache.maven:maven-plugin-api:jar:3.0:compile
[DEBUG] org.apache.maven:maven-model:jar:3.0:compile
[DEBUG] org.apache.maven:maven-artifact:jar:3.0:compile
[DEBUG] org.sonatype.sisu:sisu-inject-plexus:jar:1.4.2:compile
[DEBUG] org.sonatype.sisu:sisu-inject-bean:jar:1.4.2:compile
[DEBUG] org.sonatype.sisu:sisu-guice:jar:noaop:2.1.7:compile
[DEBUG] org.apache.maven:maven-core:jar:3.0:compile
[DEBUG] org.apache.maven:maven-settings:jar:3.0:compile
[DEBUG] org.apache.maven:maven-settings-builder:jar:3.0:compile
[DEBUG] org.apache.maven:maven-repository-metadata:jar:3.0:compile
[DEBUG] org.apache.maven:maven-model-builder:jar:3.0:compile
[DEBUG] org.apache.maven:maven-aether-provider:jar:3.0:runtime
[DEBUG] org.sonatype.aether:aether-impl:jar:1.7:compile
[DEBUG] org.sonatype.aether:aether-spi:jar:1.7:compile
[DEBUG] org.sonatype.aether:aether-api:jar:1.7:compile
[DEBUG] org.sonatype.aether:aether-util:jar:1.7:compile
[DEBUG] org.codehaus.plexus:plexus-interpolation:jar:1.14:compile
[DEBUG] org.codehaus.plexus:plexus-classworlds:jar:2.2.3:compile
[DEBUG] org.codehaus.plexus:plexus-component-annotations:jar:1.5.5:compile
[DEBUG] org.sonatype.plexus:plexus-sec-dispatcher:jar:1.3:compile
[DEBUG] org.sonatype.plexus:plexus-cipher:jar:1.4:compile
[DEBUG] org.codehaus.plexus:plexus-utils:jar:3.0.22:compile
[DEBUG] org.apache.maven.shared:file-management:jar:1.2.1:compile
[DEBUG] org.apache.maven.shared:maven-shared-io:jar:1.1:compile
[DEBUG] org.apache.maven:maven-artifact-manager:jar:2.0.2:compile
[DEBUG] org.apache.maven.wagon:wagon-provider-api:jar:1.0-alpha-6:compile
[DEBUG] org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9:compile
[DEBUG] junit:junit:jar:4.8.2:compile (version managed from default)
[DEBUG] classworlds:classworlds:jar:1.1-alpha-2:compile
[DEBUG] org.apache.maven.reporting:maven-reporting-api:jar:3.0:compile
[DEBUG] org.apache.maven.doxia:doxia-sink-api:jar:1.0:compile
[DEBUG] org.apache.maven.reporting:maven-reporting-impl:jar:2.1:compile
[DEBUG] org.apache.maven:maven-project:jar:2.0.10:compile
[DEBUG] org.apache.maven:maven-profile:jar:2.0.10:compile
[DEBUG] org.apache.maven:maven-plugin-registry:jar:2.0.10:compile
[DEBUG] org.apache.maven.doxia:doxia-core:jar:1.1.2:compile
[DEBUG] org.apache.maven.doxia:doxia-logging-api:jar:1.1.2:compile
[DEBUG] xerces:xercesImpl:jar:2.8.1:compile
[DEBUG] commons-lang:commons-lang:jar:2.4:compile
[DEBUG] commons-httpclient:commons-httpclient:jar:3.1:compile
[DEBUG] commons-codec:commons-codec:jar:1.2:compile
[DEBUG] org.apache.maven.doxia:doxia-site-renderer:jar:1.1.2:compile
[DEBUG] org.apache.maven.doxia:doxia-decoration-model:jar:1.1.2:compile
[DEBUG] org.apache.maven.doxia:doxia-module-xhtml:jar:1.1.2:compile
[DEBUG] org.apache.maven.doxia:doxia-module-fml:jar:1.1.2:compile
[DEBUG] org.codehaus.plexus:plexus-i18n:jar:1.0-beta-7:compile
[DEBUG] org.codehaus.plexus:plexus-velocity:jar:1.1.7:compile
[DEBUG] org.apache.velocity:velocity:jar:1.5:compile
[DEBUG] commons-collections:commons-collections:jar:3.2.2:compile (version managed from default)
[DEBUG] commons-validator:commons-validator:jar:1.2.0:compile
[DEBUG] commons-beanutils:commons-beanutils:jar:1.7.0:compile
[DEBUG] commons-digester:commons-digester:jar:1.6:compile
[DEBUG] commons-logging:commons-logging:jar:1.0.4:compile
[DEBUG] oro:oro:jar:2.0.8:compile
[DEBUG] xml-apis:xml-apis:jar:1.0.b2:compile
[DEBUG] org.jacoco:org.jacoco.agent:jar:runtime:0.8.5:compile
[DEBUG] org.jacoco:org.jacoco.core:jar:0.8.5:compile
[DEBUG] org.ow2.asm:asm:jar:7.2:compile (version managed from default)
[DEBUG] org.ow2.asm:asm-commons:jar:7.2:compile (version managed from default)
[DEBUG] org.ow2.asm:asm-analysis:jar:7.2:compile (version managed from default)
[DEBUG] org.ow2.asm:asm-tree:jar:7.2:compile (version managed from default)
[DEBUG] org.jacoco:org.jacoco.report:jar:0.8.5:compile
[DEBUG] Created new class realm plugin>org.jacoco:jacoco-maven-plugin:0.8.5
[DEBUG] Importing foreign packages into class realm plugin>org.jacoco:jacoco-maven-plugin:0.8.5
[DEBUG] Imported: < maven.api
[DEBUG] Populating class realm plugin>org.jacoco:jacoco-maven-plugin:0.8.5
[DEBUG] Included: org.jacoco:jacoco-maven-plugin:jar:0.8.5
[DEBUG] Included: org.sonatype.sisu:sisu-inject-bean:jar:1.4.2
[DEBUG] Included: org.sonatype.sisu:sisu-guice:jar:noaop:2.1.7
[DEBUG] Included: org.sonatype.aether:aether-util:jar:1.7
[DEBUG] Included: org.codehaus.plexus:plexus-interpolation:jar:1.14
[DEBUG] Included: org.codehaus.plexus:plexus-component-annotations:jar:1.5.5
[DEBUG] Included: org.sonatype.plexus:plexus-sec-dispatcher:jar:1.3
[DEBUG] Included: org.sonatype.plexus:plexus-cipher:jar:1.4
[DEBUG] Included: org.codehaus.plexus:plexus-utils:jar:3.0.22
[DEBUG] Included: org.apache.maven.shared:file-management:jar:1.2.1
[DEBUG] Included: org.apache.maven.shared:maven-shared-io:jar:1.1
[DEBUG] Included: junit:junit:jar:4.8.2
[DEBUG] Included: org.apache.maven.reporting:maven-reporting-api:jar:3.0
[DEBUG] Included: org.apache.maven.doxia:doxia-sink-api:jar:1.0
[DEBUG] Included: org.apache.maven.reporting:maven-reporting-impl:jar:2.1
[DEBUG] Included: org.apache.maven.doxia:doxia-core:jar:1.1.2
[DEBUG] Included: org.apache.maven.doxia:doxia-logging-api:jar:1.1.2
[DEBUG] Included: xerces:xercesImpl:jar:2.8.1
[DEBUG] Included: commons-lang:commons-lang:jar:2.4
[DEBUG] Included: commons-httpclient:commons-httpclient:jar:3.1
[DEBUG] Included: commons-codec:commons-codec:jar:1.2
[DEBUG] Included: org.apache.maven.doxia:doxia-site-renderer:jar:1.1.2
[DEBUG] Included: org.apache.maven.doxia:doxia-decoration-model:jar:1.1.2
[DEBUG] Included: org.apache.maven.doxia:doxia-module-xhtml:jar:1.1.2
[DEBUG] Included: org.apache.maven.doxia:doxia-module-fml:jar:1.1.2
[DEBUG] Included: org.codehaus.plexus:plexus-i18n:jar:1.0-beta-7
[DEBUG] Included: org.codehaus.plexus:plexus-velocity:jar:1.1.7
[DEBUG] Included: org.apache.velocity:velocity:jar:1.5
[DEBUG] Included: commons-collections:commons-collections:jar:3.2.2
[DEBUG] Included: commons-validator:commons-validator:jar:1.2.0
[DEBUG] Included: commons-beanutils:commons-beanutils:jar:1.7.0
[DEBUG] Included: commons-digester:commons-digester:jar:1.6
[DEBUG] Included: commons-logging:commons-logging:jar:1.0.4
[DEBUG] Included: oro:oro:jar:2.0.8
[DEBUG] Included: xml-apis:xml-apis:jar:1.0.b2
[DEBUG] Included: org.jacoco:org.jacoco.agent:jar:runtime:0.8.5
[DEBUG] Included: org.jacoco:org.jacoco.core:jar:0.8.5
[DEBUG] Included: org.ow2.asm:asm:jar:7.2
[DEBUG] Included: org.ow2.asm:asm-commons:jar:7.2
[DEBUG] Included: org.ow2.asm:asm-analysis:jar:7.2
[DEBUG] Included: org.ow2.asm:asm-tree:jar:7.2
[DEBUG] Included: org.jacoco:org.jacoco.report:jar:0.8.5
[DEBUG] Configuring mojo org.jacoco:jacoco-maven-plugin:0.8.5:report from plugin realm ClassRealm[plugin>org.jacoco:jacoco-maven-plugin:0.8.5, parent: jdk.internal.loade
r.ClassLoaders$AppClassLoader@4e0e2f2a]
[DEBUG] Setting property: classpath.resource.loader.class => 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
[DEBUG] Setting property: site.resource.loader.class => 'org.codehaus.plexus.velocity.SiteResourceLoader'.
[DEBUG] Setting property: velocimacro.messages.on => 'false'.
[DEBUG] Setting property: runtime.log.invalid.references => 'false'.
[DEBUG] Setting property: resource.loader => 'classpath,site'.
[DEBUG] Setting property: velocimacro.permissions.allow.inline.to.replace.global => 'true'.
[DEBUG] Setting property: resource.manager.logwhenfound => 'false'.
[DEBUG] *******************************************************************
[DEBUG] Starting Apache Velocity v1.5 (compiled: 2007-02-22 08:52:29)
[DEBUG] RuntimeInstance initializing.
[DEBUG] Default Properties File: org\apache\velocity\runtime\defaults\velocity.properties
[DEBUG] LogSystem has been deprecated. Please use a LogChute implementation.
[DEBUG] Default ResourceManager initializing. (class org.apache.velocity.runtime.resource.ResourceManagerImpl)
[DEBUG] ResourceLoader instantiated: org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader
[DEBUG] ResourceLoader instantiated: org.codehaus.plexus.velocity.SiteResourceLoader
[DEBUG] ResourceCache: initialized (class org.apache.velocity.runtime.resource.ResourceCacheImpl)
[DEBUG] Default ResourceManager initialization complete.
[DEBUG] Loaded System Directive: org.apache.velocity.runtime.directive.Literal
[DEBUG] Loaded System Directive: org.apache.velocity.runtime.directive.Macro
[DEBUG] Loaded System Directive: org.apache.velocity.runtime.directive.Parse
[DEBUG] Loaded System Directive: org.apache.velocity.runtime.directive.Include
[DEBUG] Loaded System Directive: org.apache.velocity.runtime.directive.Foreach
[DEBUG] Created '20' parsers.
[DEBUG] Velocimacro : initialization starting.
[DEBUG] Velocimacro : allowInline = true : VMs can be defined inline in templates
[DEBUG] Velocimacro : allowInlineToOverride = true : VMs defined inline may replace previous VM definitions
[DEBUG] Velocimacro : allowInlineLocal = false : VMs defined inline will be global in scope if allowed.
[DEBUG] Velocimacro : autoload off : VM system will not automatically reload global library macros
[DEBUG] Velocimacro : Velocimacro : initialization complete.
[DEBUG] RuntimeInstance successfully initialized.
[DEBUG] Configuring mojo 'org.jacoco:jacoco-maven-plugin:0.8.5:report' with basic configurator -->
[DEBUG] (f) dataFile = C:\Users\bob\Documents\Github\blah-on-codecommit\target\jacoco.exec
[DEBUG] (f) outputDirectory = C:\Users\bob\Documents\Github\blah-on-codecommit\target\site\jacoco
[DEBUG] (f) outputEncoding = UTF-8
[DEBUG] (f) project = MavenProject: com.bob.blob:blah:0.0.1-SNAPSHOT @ C:\Users\bob\Documents\Github\blah-on-codecommit\pom.xml
[DEBUG] (f) skip = false
[DEBUG] (f) sourceEncoding = UTF-8
[DEBUG] (f) title = Blah
[DEBUG] -- end configuration --
[INFO] Skipping JaCoCo execution due to missing execution data file.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.256 s
[INFO] Finished at: 2019-12-16T15:05:58-05:00
[INFO] ------------------------------------------------------------------------
<小时/>

普通命令

运行时 mvn install :

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< com.bob.blob:blah >------------------
[INFO] Building Blah 0.0.1-SNAPSHOT
[INFO] --------------------------------[ war ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ blah ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ blah ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ blah ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\bob\Documents\Github\blah-on-codecommit\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ blah ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ blah ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------

// ... SKIPPING ALL OF THE SPRINGBOOT STUFF

[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 27.772 s - in com.bob.blob.blah.BlahApplicationTests
[INFO] Running com.bob.blob.blah.RandomTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.003 s - in com.bob.blob.blah.RandomTest
2019-12-16 15:11:10.717 INFO 14224 --- [extShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor'
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- maven-war-plugin:3.2.3:war (default-war) @ blah ---
[INFO] Packaging webapp
[INFO] Assembling webapp [blah] in [C:\Users\bob\Documents\Github\blah-on-codecommit\target\ROOT]
[INFO] Processing war project
[INFO] Webapp assembled in [621 msecs]
[INFO] Building war: C:\Users\bob\Documents\Github\blah-on-codecommit\target\ROOT.war
[INFO]
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ blah ---
[INFO] Installing C:\Users\bob\Documents\Github\blah-on-codecommit\target\ROOT.war to C:\Users\bob\.m2\repository\com\bob\blob\blah\0.0.1-
SNAPSHOT\blah-0.0.1-SNAPSHOT.war
[INFO] Installing C:\Users\bob\Documents\Github\blah-on-codecommit\pom.xml to C:\Users\bob\.m2\repository\com\bob\blob\blah\0.0.1-SNAPSHOT\blah-0.0.1-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 35.674 s
[INFO] Finished at: 2019-12-16T15:11:13-05:00
[INFO] ------------------------------------------------------------------------
<小时/>

最终

我们将添加failsafe将来也会作为插件,但这还没有完成。

最佳答案

我终于找到了一个对我有帮助的答案:https://stackoverflow.com/a/36305148/9768291

基本上,我试图在 pluginManagement 标记内设置 jacoco 插件,但它一开始并没有被声明为插件。我将代码从 build/pluginManagement/plugins 移至 build/plugins,现在一切正常。

关于java - Jacoco 从未调用过 "mvn install"。手动触发时(("mvn jacoco:report"),表示执行数据文件丢失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59363758/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com