-source 1.3不支持泛型 [英] generics are not supported in -source 1.3

查看:94
本文介绍了-source 1.3不支持泛型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

maven包装我有问题。在这段代码中:

  public class LoginDialog extends Dialog {

private final TextField< String>顾客;
^ here
private final TextField< String> login1;
private final TextField< String>密码1;
private final MainController controller = new MainController();
private String customerId;
私人字符串登录;
私人字符串密码;

我有这样的错误:

  [错误] BUILD FAILURE 
[INFO] ----------------------------- -------------------------------------------
[信息]编译失败
... src / main / java / com / messagedna / web / client / widget / LoginDialog.java:[19,27]错误:-source 1.3
不支持泛型, code>

这可能是什么原因?

解决方案

在java 1.5中添加了泛型。您的maven正在为java 1.3编译。



这可以通过以下两种方式之一来解决。



删除泛型所以你可以编译< 1.5



更改maven配置以编译更新版本的java。您应该可以在您的pom中编辑您的编译器插件:

 < plugin> 
< groupId> org.apache.maven.plugins< / groupId>
< artifactId> maven-compiler-plugin< / artifactId>
< version> 3.0< / version>
<配置>
< source> 1.5< / source>
< target> 1.5< / target>
< / configuration>
< / plugin>

这告诉maven编译为1.5


I have a problem while maven packaging. In this code:

public class LoginDialog extends Dialog {

    private final TextField<String> customer;
                          ^here
    private final TextField<String> login1;
    private final TextField<String> password1;
    private final MainController controller= new MainController();
    private String customerId;
    private String login;
    private String password;

I have an error like:

[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure
...src/main/java/com/messagedna/web/client/widget/LoginDialog.java:[19,27] error: generics are not supported in -source 1.3

what may be the reason of this?

解决方案

Generics were added in java 1.5. Your maven is compiling for java 1.3.

This can be fixed in one of two ways.

Remove generics so that you can compile for < 1.5

Change the maven configuration to compile for a newer version of java. You should be able to edit your compiler plugin in your pom:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.0</version>
            <configuration>
                <source>1.5</source>
                <target>1.5</target>
            </configuration>
        </plugin>

This tells maven to compile for 1.5

这篇关于-source 1.3不支持泛型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆