Solucionado (ver solução)
Solucionado
(ver solução)
3
respostas

O diretório "/target/site/jacoco" não foi criado

Boa noite!

Executei o comando mvn verify, mas o diretório /target/site/jacoco não foi criado.

Saída do terminal:

C:\Users\jonasbj\Desktop\eclipse-workspace\produtos>mvn verify
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building produtos 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ produtos -
--
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\jonasbj\Desktop\eclipse-work
space\produtos\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ produtos ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ pr
odutos ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\jonasbj\Desktop\eclipse-work
space\produtos\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ produ
tos ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ produtos ---
[INFO] Surefire report directory: C:\Users\jonasbj\Desktop\eclipse-workspace\pro
dutos\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running br.com.alura.maven.AppTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.006 sec

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ produtos ---
[INFO]
[INFO] >>> maven-pmd-plugin:3.6:check (default) > :pmd @ produtos >>>
[INFO]
[INFO] --- maven-pmd-plugin:3.6:pmd (pmd) @ produtos ---
[WARNING] Unable to locate Source XRef to link to - DISABLED
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. b
uild is platform dependent!
[INFO]
[INFO] <<< maven-pmd-plugin:3.6:check (default) < :pmd @ produtos <<<
[INFO]
[INFO] --- maven-pmd-plugin:3.6:check (default) @ produtos ---
[INFO]
[INFO]
[INFO] --- jacoco-maven-plugin:0.7.6.201602180812:prepare-agent (default) @ prod
utos ---
[INFO] argLine set to -javaagent:C:\\Users\\jonasbj\\.m2\\repository\\org\\jacoc
o\\org.jacoco.agent\\0.7.6.201602180812\\org.jacoco.agent-0.7.6.201602180812-run
time.jar=destfile=C:\\Users\\jonasbj\\Desktop\\eclipse-workspace\\produtos\\targ
et\\jacoco.exec
[INFO]
[INFO] --- jacoco-maven-plugin:0.7.6.201602180812:report (default) @ produtos --
-
[INFO] Skipping JaCoCo execution due to missing execution data file:C:\Users\jon
asbj\Desktop\eclipse-workspace\produtos\target\jacoco.exec
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.828 s
[INFO] Finished at: 2018-08-09T18:02:04-03:00
[INFO] Final Memory: 22M/208M
[INFO] ------------------------------------------------------------------------
C:\Users\jonasbj\Desktop\eclipse-workspace\produtos>
3 respostas

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>br.com.alura.maven</groupId>
    <artifactId>produtos</artifactId>
    <packaging>jar</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>produtos</name>
    <url>http://maven.apache.org</url>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>

        <!-- https://mvnrepository.com/artifact/com.thoughtworks.xstream/xstream -->
        <dependency>
            <groupId>com.thoughtworks.xstream</groupId>
            <artifactId>xstream</artifactId>
            <version>1.4.10</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.8.5</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-pmd-plugin</artifactId>
                <version>3.6</version>
                <executions>
                    <execution>
                        <phase>verify</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.7.6.201602180812</version>
                <executions>
                    <execution>
                        <phase>verify</phase>
                        <goals>
                            <goal>prepare-agent</goal>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
solução!

Achei o erro!

O arquivo pom.xml estava assim:

                <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.7.6.201602180812</version>
                <executions>
                    <execution>
                        <phase>verify</phase>
                        <goals>
                            <goal>prepare-agent</goal>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

Eu removi a linha:

<phase>verify</phase>

Executei o comando mvn verify e o diretório /target/site/jacoco foi criado, com o relatório dentro.

Boa!!!