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

Erro no mvn compile

Boa tarde pessoal. Acontece o seguinte erro quando tento utilizar o comando mvn compile:

PS C:\Users\jgabr\eclipse-workspace\loja> mvn compile
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] Malformed POM C:\Users\jgabr\eclipse-workspace\loja\pom.xml: Unrecognised tag: 'id' (position: START_TAG seen ...<repositories>\r\n\t\t<id>... @24:7)  @ C:\Users\jgabr\eclipse-workspace\loja\pom.xml, line 24, column 7
 @
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR]   The project br.com.alura:loja:1.0.0 (C:\Users\jgabr\eclipse-workspace\loja\pom.xml) has 1 error
[ERROR]     Malformed POM C:\Users\jgabr\eclipse-workspace\loja\pom.xml: Unrecognised tag: 'id' (position: START_TAG seen ...<repositories>\r\n\t\t<id>... @24:7)  @ C:\Users\jgabr\eclipse-workspace\loja\pom.xml, line 24, column 7 -> [Help 2]
[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/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/ModelParseException
PS C:\Users\jgabr\eclipse-workspace\loja>
PS C:\Users\jgabr\eclipse-workspace\loja>

percebi que o erro parecia ser na sintaxe dos repositorios, daí eu removi essa parte do arquivo pom.xml, que está localizado logo acima do </project>:

    <repositories>
        <id>spring-repo</id>
        <url>https://repo.spring.io/release</url>
    </repositories>

e ao rodar novamente, deu certo:

PS C:\Users\jgabr\eclipse-workspace\loja> mvn compile
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------------< br.com.alura:loja >--------------------------
[INFO] Building loja 1.0.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ loja ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ loja ---
[INFO] Nothing to compile - all classes are up to date
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.811 s
[INFO] Finished at: 2022-04-05T14:22:13-03:00
[INFO] ------------------------------------------------------------------------
PS C:\Users\jgabr\eclipse-workspace\loja>

estou usando o marven versão 3.8.5

2 respostas
solução!

achei o erro. no lugar de

    <repositories>
        <id>spring-repo</id>
        <url>https://repo.spring.io/release</url>
    </repositories>

era pra colocar

    <repositories>
        <repository>
            <id>spring-repo</id>
            <url>https://repo.spring.io/release</url>
        </repository>
    </repositories>

Oi João,

O problema foi nessa parte:

<repositories>
    <id>spring-repo</id>
    <url>https://repo.spring.io/release</url>
</repositories>

O id e url devem ficar dentro de um <repository> e não "soltos" na tag <repositories>. Exemplo:

<repositories>
    <repository>
        <id>spring-repo</id>
        <url>https://repo.spring.io/release</url>
    </repository>
</repositories>

Bons estudos!