使用Netbeans的Maven项目中的控制台损坏 [英] Broken console in Maven project using Netbeans

查看:89
本文介绍了使用Netbeans的Maven项目中的控制台损坏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Neatens + Maven安装有一个奇怪的问题.这是重现该问题的最短代码:

I have strange problem with my Neatens+Maven installation. This is the shortest code to reproduce the problem:

public class App 
{
    public static void main( String[] args )
    {
           // Create a scanner to read from keyboard
    Scanner scanner = new Scanner (System.in);

   Scanner s= new Scanner(System.in);
    String param= s.next();
    System.out.println(param);
    }
}

当我在Netbeans控制台中以Maven Project形式运行它时,似乎已损坏.它只是忽略了我的输入.看起来像String param= s.next();中的不定式循环"(或者像String param= s.next();放在不定式循环中一样)

When I'm running it as Maven Project inside Netbeans console seems to be broken. It just ignores my input. It's look like "infinitive loop" in String param= s.next(); (or like String param= s.next(); placed in infinitive loop)

但是,当将该项目编译为"Java Aplication"项目时,它可以很好地工作.它也可以正常工作如果我从cmd构建并运行它.

However this project works fine when it's compiled as "Java Aplication" project. It also works O.K. if I build and run it from cmd.

系统信息: 操作系统:Vista IDE:Netbeans 6.8 Maven:apache-maven-2.2.1

System info: Os: Vista IDE: Netbeans 6.8 Maven: apache-maven-2.2.1

//编辑

内置程序(使用Netbeans的mavean)工作正常(我可以从Windows cmd运行它).我只是无法测试(使用Netbeans也不可以运行或 debug:()

Built program (using mavean from Netbeans) works fine (I can run it from Windows cmd). I just can't test it (Run nor debug :() using Netbeans.

我想我忘记问这个问题了;).所以,当然,我的第一个问题是:如何解决这个问题?

And I think I forgot to ask the question ;). So of course my first question is: how can I fix this problem?

第二个是:这有什么解决方法吗?例如,将Netbeans配置为运行外部命令行应用程序而不是使用内置控制台.

And second is: Is it any workaround for this? For example configuring Netbeans to run external commend line app instead of using built in console.

//编辑 还有一个更新:

我使用Exec Maven插件1.1.1版 NB 6.9 RC2中也会出现问题.在两个NB版本(6.8和6.9 RC2)中,我测试了maven 3.0-beta-1和maven-2.2.1,结果相同.

I use Exec Maven Plugin version 1.1.1 Problem also occurs in NB 6.9 RC2. In both NB versions (6.8 and 6.9 RC2) I tested maven 3.0-beta-1 and maven-2.2.1 with the same result.

推荐答案

您可以使用exec目标exec:java在同一个虚拟机中运行应用程序(默认为exec:exec-新虚拟机).

You can use the exec goal exec:java to run the app in the same vm (default is exec:exec - new vm).

这篇关于使用Netbeans的Maven项目中的控制台损坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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