John,

I'm going back a few emails in this thread but that is because things appear to be heading in the wrong direction. This is an attempt to get you back on the right track.

On 18/02/2022 15:50, John Barrow wrote:

<snip/>

I use Netbeans 12.6 (Apache loyalty!) on Windows 10 for all my Java
development using JDK 17.

Ack. I use Eclipse so I can't provide NetBeans specific help but I should be able to point you in the right direction.

Unfortunately, I am only ‘sort-of’ familiar with Maven and have never
touched Ant so I am flying a bit blind here, but that shouldn’t matter
if it all works as I don't need to touch the build process.

I downloaded the ‘main’ branch from GitHub
(https://github.com/apache/tomcat) and unzipped it into its own
folder, again with Ant (apache-ant-1.9.16).

If you eventual aim is to provide a pull request to address this issue then I'd recommend:
- Fork the Tomcat project in GitHub
- Checkout your clone

I have managed to get Ant to build it using instructions in
BUILDING.txt. While it says that Tomcat built successfully, scrolling
up, I got lots of warnings saying ‘can’t find a module etc so not sure
if doing something wrong. I can send the results as an attachment if
that would be useful.

Hmm. You shouldn't see any warnings about modules. A handful of warnings about deprecation are expected. If you still see these warnings then yes, please provide a copy so we can take a look.

The simplest way to test the build is to try the following:
cd output\build\bin
catalina.bat run

That should start a Tomcat instance in the console. Check http://localhost:8080 returns a web page in your browser and then stop Tomcat with CTRL-C

I can also get it to build in Netbeans (I first had to set  Project >
Properties > Java Sources to Source Level 17 which may be a bit of a
guess as Netbeans complained about default value of 1.7). The java
files in Netbeans don’t highlight any exceptions, just warnings.

Tomcat 10.1.x (the current main branch) requires Java 11 as a minimum. You should be fine setting the source level to anything 11 or above. Personally, I'd set it to 11 as that way you avoid the (very low) risk of proposing a fix that doesn't work on Java 11.

I appear to have issues with the other two folders
‘C:\Community\Tomcat\tomcat-main\webapps\docs\appdev\sample\src\mypackage’

Tell NetBeans to ignore that folder. It should not be part of the source you are trying to compile. It is part of a (rather old) tutorial on building a web application.

and ‘C:\Community\Tomcat\tomcat-main\test’ as they don’t seem to be
able to locate the dependencies (HelloWorld is -e.g. import
jakarta.servlet.http.HttpServlet & tests is -e.g. import
org.junit.Assert). In Maven, I would add a dependency to the pom.xml
file, but not sure what to do in Ant as I would expect the
configuration to already be set up.

The problem there is that the JUnit reference in the NetBeans configuration wasn't updated when the JUnit version was updated.

I've just fixed that.

This is where using a clone would speed things up as you'd be able to fetch the update from Git.

Once you have the updated sources see res/ide-support/netbeans/README.txt about running:

ant ide-netbeans-replace

I also ran the ‘ant test’, took about 90 minutes and failed a number
of tests (which I thought was surprising as I would expect sources in
the repository to pass all the tests. I can provide examples if useful
as it may indicate that I have done something wrong.

I wouldn't worry too much about these right now. There are various tests that are sensitive to timing, network configuration and/or OS configuration.

What I would recommend is that if you change code, you run the tests associated with the class/classes you have changed. That should catch most issues.

We can work on getting the full test suite passing but I'd suggest that that is not the priority.

I read through the ‘RUNNING.txt’ file, but that assumes a binary to
start, rather than following on from BUILDING Tomcat and so I couldn’t
relate that to what I was trying to achieve.

After a successful build, the "output/build" directory will contain a ready to run Tomcat instance. It is both CATALINA_HOME and CATALINA_BASE so RUNNING.txt should make sense if you start in that directory.

However, if I launch Tomcat from within Netbeans (F6), I get a dialog
which I don’t understand - probably due to my lack of familiarity with
Ant. Again, I can include a screenshot if that would help.

Looking at res/ide-support/netbeans/README.txt, I don't believe that mode of operation is supported. You should be able to run Tomcat from the command line with debugging enabled:

catalina.bat jpda run

and then remote debug in NetBeans.

I need to be able to run the locally built version of Tomcat so that,
as a starting point, I can add some System.out.print() messages around
the relevant routines (which I have located – thanks Mark). Of course
I am assuming that it is possible to develop Tomcat from within
Netbeans.

I don't think that way of working is an option.

I believe the way most Tomcat committers work is running Tomcat on the command line and remote debugging from their IDE of choice.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to