Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

646
Visualizações
java 1.7+ is not supported in -source 1.5 errors

I'm getting all sort of java errors not supported in -source 1.5 when creating my Maven Install in eclipse. There is nothing wrong with my code.

Errors follows:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1
[23,62] multi-catch statement is not supported in -source 1.5 
[241,29] try-with-resources is not supported in -source 1.5
[156,64] diamond operator is not supported in -source 1.5

My pom configuration follows:

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>3.2.3</version>
        <configuration>
            <source>1.8</source>
            <target>1.8</target>
            <encoding>UTF-8</encoding>
        </configuration>
    </plugin>
over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Add the following lines in your pom.xml file should resolve your problem.

<properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
</properties>

If you may take in consideration the advises that were provided to you. You would have 2 options to choose from:

Option 1) If you keep the maven-war-plugin. Update version to the latest then add the properties with the compiler info and sourceEncoding but remove the configuration lines:

<properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
    
    ..
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>3.3.1</version>
    </plugin>
    ..
</build>

Option 2) If you replace maven-war-plugin with the maven-compiler-plugin ** There are no need to add/replace the source, target and encoding to the properties**. Make sure to update the version to the latest:

<build>
    ..
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.1</version>
        <configuration>
            <source>1.8</source>
            <target>1.8</target>
            <encoding>UTF-8</encoding>
        </configuration>
    </plugin>
    ..
</build>
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda