Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 162416 - Cannot run command-line app in a maven project
Cannot run command-line app in a maven project
Status: RESOLVED DUPLICATE of bug 188864
Product: projects
Classification: Unclassified
Component: Maven
All Windows XP
: P3 (vote)
: 7.0
Assigned To: David Simonek
: 170229 (view as bug list)
Depends on:
  Show dependency treegraph
Reported: 2009-04-10 16:13 UTC by Chris Kutler
Modified: 2010-08-05 13:39 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT


Note You need to log in before you can comment on or make changes to this bug.
Description Chris Kutler 2009-04-10 16:13:26 UTC
Below is a simple command line app. I made it as simple as possible to communicate my problem with running command line
apps in NetBeans if I use the Maven plugin.

If I create a regular Java project, put in this code, and run the project, the app works fine.

If I create a Maven project using the Maven plugin and NetBeans 6.5.1, and put in this code, the prompt does not appear
and my input does not get processed. Also, the only way to stop running the app is to shut NetBeans. Clicking the x
boxes does nothing.

What am I doing wrong?

package delme;


public class Main {

 static String readln() {
   InputStreamReader inputStrReader = new InputStreamReader(;
   BufferedReader buffRdr = new BufferedReader(inputStrReader);
   String str = null;
   try {
     str = buffRdr.readLine();
   } catch (IOException ioe) {
   return str;

 public static void main(String[] args) {
   while (true) {
     System.out.print("> ");
     String str = readln();
     String[] input = str.split("\\s");
     if (input[0].equals("exit") || input[0].equals("quit")) {
     System.out.println("You said " + str + " and length = " + input.length);
     for (int x = 0; x < input.length; x++) {
     for (int i = 0; i < input.length; i++) {
Comment 1 Antonin Nebuzelsky 2009-04-10 16:54:50 UTC
Confirming in 6.7 dev.

Process output does not seem connected to the output window.
Comment 2 Milos Kleint 2009-04-14 09:10:56 UTC
the issue is most likely in the external project - exec-maven-plugin.

While I'll try to create a patch for the exec plugin, it cannot be determined when the patch appears in a release
version of exec-maven-plugin. Thus setting milestone to "next".

Comment 3 Milos Kleint 2009-08-12 13:18:48 UTC
*** Issue 170229 has been marked as a duplicate of this issue. ***
Comment 4 Milos Kleint 2009-11-10 06:13:30 UTC
applied in svn repository. I've deployed a snapshot for testing at

to use it, declare the repository in settings.xml file and then change the action mapping in the IDE to 1.1.2-SNAPSHOT (instead of the current 1.1.1)
Comment 5 Antonin Nebuzelsky 2010-07-23 12:02:10 UTC
Fixed by exec-maven-plugin 1.2, see also issue 188864.
Comment 6 Antonin Nebuzelsky 2010-07-23 12:05:22 UTC
Verified in older build of NetBeans (which does not include fix of #188864) by changing Run Project action's Execute Goals property to use 1.2 in project's Properties/Actions which adds the following configuration to nbactions.xml in project's root

<?xml version="1.0" encoding="UTF-8"?>
                <exec.args>-classpath %classpath ${packageClassName}</exec.args>
Comment 7 Antonin Nebuzelsky 2010-07-23 12:19:02 UTC
Verified also with a new project created with the latest dev build which contains the fix of #188864. By default version 1.2 of exec-maven-plugin is used and the process output/input is correctly bound to Output window.
Comment 8 Jesse Glick 2010-08-05 13:39:54 UTC

*** This bug has been marked as a duplicate of bug 188864 ***

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo