Domanda

I'm trying to run 'mvn clean install' in a sub-module of a multi-module project. The project is Jacoco but I assume it's more an issue of me not understanding how Maven is being used here than an issue with Jacoco itself.

https://github.com/jacoco/jacoco/blob/master/jacoco-maven-plugin.test/it/it-site/pom.xml

I get the following error:

[ERROR] Plugin @project.groupId@:jacoco-maven-plugin:@project.version@ or one of its dependencies could not be resolved: Failed to read artifact descriptor for @project.groupId@:jacoco-maven-plugin:jar:@project.version@

I see the following in the pom:

<groupId>@project.groupId@</groupId>
<artifactId>jacoco-maven-plugin</artifactId>

I'm not familiar with using the @ symbol in @project.groupId@ although i assume it is somehow supposed to get substituted at runtime.

I can run Maven from the top level pom and I even see [INFO] Building: it-site/pom.xml in the log but a target directory is not created there.

A nudge in the right direction would be appreciated.

È stato utile?

Soluzione

This probably has something to do with the pom file here: https://github.com/jacoco/jacoco/blob/master/jacoco-maven-plugin.test/pom.xml

It is using a plugin called the maven invoker.

The Invoker Plugin is used to run a set of Maven projects. The plugin can determine whether each project execution is successful, and optionally can verify the output generated from a given project execution.

And if you read about filtering files with this plugin, it mentions:

POM files selected by the include/exclude patterns. The tokens to be filtered must be enclosed in @...@ to avoid interferences with Maven's normal POM interpolation, i.e. use @project.version@ instead of ${project.version}.

Altri suggerimenti

Regarding why the Invoker Plugin and filtering is being used here...

The Spring Boot documentation provides some relevant background on why that is. Although the docs are for Spring Boot, i think it applies to testing all plugins (which Jacoco is).

Multi-module Maven builds cannot directly include maven plugins that are part of the reactor unless they have previously been built. ... The standard build works around this restriction by launching the samples via the maven-invoker-plugin so that they are not part of the reactor.

The sample application are used as integration tests during the build (when you mvn install). Due to the fact that they make use of the spring-boot-maven-plugin they cannot be called directly, and so instead are launched via the maven-invoker-plugin.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top