10 May 18:20
Re: cannot run main() in a Maven jar project
From: Qingtian Wang <qingtian.wang <at> gmail.com>
Subject: Re: cannot run main() in a Maven jar project
Newsgroups: gmane.comp.java.ide.netbeans.user
Date: 2008-05-10 16:20:00 GMT
Subject: Re: cannot run main() in a Maven jar project
Newsgroups: gmane.comp.java.ide.netbeans.user
Date: 2008-05-10 16:20:00 GMT
I verified that the same main() method runs fine in a standard "Java Application" project. So it seems to be a problem specific to the Maven project type.
-Qingtian
On Fri, May 9, 2008 at 11:05 AM, Qingtian Wang <qingtian.wang <at> gmail.com> wrote:
Hi,
I have a Maven jar project opened in NetBeans 6.1. And I am having trouble running the following main() method:
public static void main(String[] args) throws IOException {
BufferedReader stdin = new BufferedReader(new InputStreamReader(
System.in));
while (true) {
System.err.print(
"Enter native command (use ' <at> ' for 'Pillow'; 'q' to quit)" +
"\n>>> ");
String cmd = stdin.readLine().trim();
if ("q".equalsIgnoreCase(cmd)) {
break;
}
}
}
The way I invoke the main method is right-click inside the main class and say "run Main.java".
The problem is after the sys error prompt line is printed in the output window, the program just hangs and doesn't take in any further std input.
Could someone point out what I am doing wrong here?
Thanks a lot!
Here's the entire output until the program hangs:
WARNING: You are running Maven builds externally, some UI functionality will not be available.
Executing:C:\Program Files\maven-2.0.7\bin\mvn.bat -Dexec.mainClass=com.ual.hcp.has.apollo.servicesImpl.testharness.NewMain package org.codehaus.mojo:exec-maven-plugin:RELEASE:java
Scanning for projects...
----------------------------------------------------------------------------
Building apolloServicesImpl
task-segment: [package, org.codehaus.mojo:exec-maven-plugin:RELEASE:java]
----------------------------------------------------------------------------
Using default encoding to copy filtered resources.
Compiling 1 source file to C:\vcs\ua-svn-custrev-hcp\trunk\has\apolloServicesImpl\target\classes
Executing tasks
[echo] Building Translets for 'sell' domain
running from root pom
[echo] Building Translets for 'pnr' domain
running from root pom
Executed tasks
Using default encoding to copy filtered resources.
Nothing to compile - all classes are up to date
Surefire report directory: C:\vcs\ua-svn-custrev-hcp\trunk\has\apolloServicesImpl\..\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.ual.hcp.has.apollo.servicesImpl.ApolloTerminalTransformerTest
Results :
Building jar: C:\vcs\ua-svn-custrev-hcp\trunk\has\apolloServicesImpl\target\apolloServicesImpl-1.0-SNAPSHOT.jar
Preparing exec:java
No goals needed for project - skipping
Enter native command (use ' <at> ' for 'Pillow'; 'q' to quit)
RSS Feed