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

mvn install

Não funcionou ! :'(

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running br.com.alura.maven.ProdutoTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.212 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. build is platform dependent!
[INFO]
[INFO] <<< maven-pmd-plugin:3.6:check (default) < :pmd @ produtos <<<
[INFO]
[INFO]
[INFO] --- maven-pmd-plugin:3.6:check (default) @ produtos ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  5.426 s
[INFO] Finished at: 2019-07-23T11:45:11-03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-pmd-plugin:3.6:check (default) on project produtos: You have 1 PMD violation. For more details see: C:\Users\Renato\Documents\Renato\workspace\calculadora\produtos\target\pmd.xml -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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/MojoFailureException
4 respostas

Oi, Renato, tudo bem?

Já deu uma olhada nesse error aqui: https://stackoverflow.com/questions/17223536/failed-to-execute-goal-org-apache-maven-pluginsmaven-compiler-plugin2-3-2comp

Oi Laís, tudo bem ! Verifiquei sim mais não funcionou, eu acho que foi por que eu criei mais um atributo na classe produto.

Oi, Renato!

Posta aqui o seu arquivo produto.java e o seu POM?

solução!

produto.java (do projeto produtos)

package br.com.alura.maven;

public class Produto {
    private final String nome;
    private final double preco;
    //private final String comida = "comida";

     public Produto(String nome, double preco, String categoria) {
            super();
            this.nome = nome;
            this.preco = preco;
        }

    public String getNome() {
        return nome;
    }

    public double getPreco() {
        return preco;
    }

    public double getProdutoComImposto() {

        return preco * 1.1;
    }

}

pom.xml (do projeto lojaweb)

<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>lojaweb</artifactId>
    <packaging>war</packaging>
    <version>1.0.0-SNAPSHOT</version>
    <name>lojaweb Maven Webapp</name>
    <url>http://maven.apache.org</url>
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
            <scope>provided</scope>
        </dependency>

        <!-- https://mvnrepository.com/artifact/br.com.caelum.stella/caelum-stella-core -->
        <dependency>
            <groupId>br.com.caelum.stella</groupId>
            <artifactId>caelum-stella-core</artifactId>
            <version>2.1.3</version>
        </dependency>

        <dependency>
            <groupId>br.com.alura.maven</groupId>
            <artifactId>produtos</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>

    </dependencies>
    <build>
        <finalName>lojaweb</finalName>
        <plugins>
            <plugin>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>9.3.7.v20160115</version>
                <configuration>
                    <scanIntervalSeconds>10</scanIntervalSeconds>
                    <webApp>
                        <contextPath>/loja</contextPath>
                    </webApp>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>