In M2, things like this are generally either passed as parameters
(-D...) or simply specified as configurations for the plugin in the
pom.xml configuration.

Actually, I can't think of a single M2 plugin that prompts the user
for input while processing etc. There is probably a good reason for
this (the forked JVM etc) so perhaps reconsider your approach?

Wayne

On 5/10/07, Grant Ingersoll <[EMAIL PROTECTED]> wrote:
Hi,

Long time M1 user upgrading to M2...

I have a Mojo that I have written that asks for user input concerning
it's operation (I use a BufferedReader wrapping System.in).  When I
run the goal standalone, everything works fine.  However, when I run
the goal as preparationGoal of the maven-release-plugin, it hangs and
never seems to get the input from the command line.  I think the
issue lies in the fact that it is a forked JVM but I am not sure.  I
have trouble debugging it, b/c the debugging options specified in the
mvn command (via MAVEN_OPTS) don't work b/c I get errors saying the
port is already in use (it starts up and listens on the port, but
then a subprocess seems to try to acquire the same port, resulting in
an error.)

Below is the code I have in my mojo.


BufferedReader reader
                 = new BufferedReader(new InputStreamReader(System.in));
             String line = null;
             try
             {
                 getLog().warn("Pre loop");
                 while (true)
                 {
                     getLog().warn
                         (tagDir
                          + " exists in the repository - [d]elete or
[a]bort?");
                     line = reader.readLine();
                     getLog().debug("Before check: " + line);
                     if (line.equalsIgnoreCase("a") ||
line.equalsIgnoreCase("d"))
                     {
                         break;
                     }
                     getLog().debug("Here: " + line);
                 }

                 getLog().warn("Line: " + line);
                 if (getLog().isDebugEnabled())
                 {
                     getLog().debug("Line: " + line);
                 }

Thanks,
Grant

--------------------------
Grant Ingersoll
Center for Natural Language Processing
http://www.cnlp.org/tech/lucene.asp

Read the Lucene Java FAQ at http://wiki.apache.org/jakarta-lucene/
LuceneFAQ



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to