apache / apache/netbeans

Unable to run webapp when relative URL has multiple parameters

Open
#6,320 0 comments 0 reactions 0 assignees View on GitHub
kind:bug needs:triage
Dominant language
Java
Stars
3.1k
Forks
935
Avg merge
2d 3h
Merged PRs (30d)
17

Description

### Apache NetBeans version

Apache NetBeans 18

### What happened

I have my webpp configured to use a relative URL with multiple parameters:

![image](https://github.com/apache/netbeans/assets/821340/5deae113-dc55-4d0e-adcf-6d873d85f4f2)

However, when I try to run it I get the following error:
`No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format : or :[:]:. Available lifecycle phases are: pre-clean, clean, post-clean, validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-site, site, post-site, site-deploy. -> [Help 1]`

When I remove the second parameter:

![image](https://github.com/apache/netbeans/assets/821340/058c0155-c212-4b18-8446-9dfdcc627041)

it runs fine.

### How to reproduce

Create a webapp using the Maven Web Application archetype. Right click to open the project properties and select the Run node. Enter a relative URL that has two or more parameters:

![image](https://github.com/apache/netbeans/assets/821340/a0c59818-2cbe-4e73-b22a-6a549f9f40c2)

Save your changes and right click on the project and select Run or Debug:

![image](https://github.com/apache/netbeans/assets/821340/e943a445-245f-4efa-8a80-3889d97d1e87)

The project will fail to run and you should see the following output in your console:

`No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format : or :[:]:. Available lifecycle phases are: pre-clean, clean, post-clean, validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-site, site, post-site, site-deploy. -> [Help 1]`

### Did this work correctly in an earlier version?

No / Don't know

### Operating System

Window 10

### JDK

Adoptium 17.0.7+7

### Apache NetBeans packaging

Apache NetBeans provided installer

### Anything else

It looks like it maybe an issue with escaping the ampersand when NB builds the command line to run the webapp (note the unescaped ampersand in "value1¶m2") :

`cd E:\nb-error-demo\nb; JAVA_HOME=E:\\jdk\\jdk-17.0.7+7 cmd /c "\"C:\\Program Files\\NetBeans-18\\netbeans\\java\\maven\\bin\\mvn.cmd\" -Dnetbeans.deploy=true -Dnetbeans.deploy.clientUrlPart=test?param1=value1¶m2=value2 -DskipTests=true -Dexec.vmArgs= -Dexec.appArgs= \"-Dmaven.ext.class.path=C:\\Program Files\\NetBeans-18\\netbeans\\java\\maven-nblib\\netbeans-eventspy.jar\" -Dfile.encoding=UTF-8 package"`

### Are you willing to submit a pull request?

No

Contributor guide

Open the contributing guide

Research direction

Reproduce with a Maven Web Application archetype, then use the project Properties Run node with a relative URL containing two parameters. Inspect how the NetBeans run command passes the URL to Maven on Windows; done means Run and Debug succeed while preserving both parameters without producing the shown Maven no-goals error.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.