Hi, > 3. Run "ant ide-netbeans"
Apologies, I should have made that point clear, I have already run that otherwise Netbeans wouldn't recognise the project at all - i.e. I couldn't open it. In that respect, it was helpful, as in I could now compile and navigate the source files. > The "deploy" target is probably the one you want, or maybe "compile". Perhaps I am expecting a different outcome. The 'clean' + 'deploy' is what happens when I 'Clean and build main project' in Netbeans speak (checking the Projects properties dialog confirms this, see attached screenshot). What I was expecting 'Run project' to do, was locate the source with the "public static void main(final String[] args)" method in it and run the application, hopefully bringing up the Netbeans console window in a CMD like window (similar to running the .bat file %CATALINA_HOME%\bin\startup.bat). In Maven, this is what happens automatically when I 'Run project', I don't believe that I ever configured anything to execute a project from within Netbeans. The only slight variance is if NetBeans finds multiple main() methods, in which case you get a popup allowing you to select the appropriate starting point. So, perhaps, an alternative question would be, how do you go about making an amendment in Eclipse within the Tomcat sources (e.g. add a System.out.println() statement to log a field to the Eclipse 'console window' and then run Tomcat to see the effect. Also how do you run the Eclipse debugger on the Tomcat application? > Do you have a list of the tests which fail? Do you know how to get that list? Yes, although I am on Windows, not UNIX and so I don't have access to grep. I did a simple search within logs for 'FAILED' and it came up with about 20 or so. The list of test results has been cleared now (probably when I next built Tomcat) and so I will need to run them again but will try using the threads at the same time and then send you the results in a separate email. > If you can run the unit tests, then they are compiling and you should be able > to build a binary release (ant deploy) without a problem. I ran the tests from a CMD prompt rather than in NetBeans. NetBeans is telling me that it can't find the resources. A quick Google seems to imply that there should be a project.xml as well as a build.xml but then as I don't know Ant, I am not sure what to expect. I will attempt to create a simple 'Hello World' project in NetBeans using Ant to see what I get so I have a simple project to refer to as a base when trying to relate Tomcat. Without this, I couldn't review or extend the tests that form part of Tomcat as any attempt to run them within Netbeans tells me that the packages don't exist. Is there anyone else in the group that is successfully developing Tomcat using Netbeans? On Fri, 18 Feb 2022 at 17:03, Christopher Schultz <ch...@christopherschultz.net> wrote: > > John, > > On 2/18/22 10:50, John Barrow wrote: > >>> Would you be interested in looking at the existing algorithm to see if > >>> it would be updated in this way? > > > >> WebappLoader.backgroundProcess() would be a good place to start. > > > > I am sort of interested in looking at this. > > Awesome! > > > I have only been playing > > with Java for about 6 months, having been a Pascal developer most of > > my life (40 odd years). Therefore, I think that I could at least ‘give > > it a look’, if I can get Tomcat installed locally. > > > > However, I appreciate that I could be well out of my depth and there > > are too many unknowns / barriers in order to be of any use. > > > > It is the installation process that I am having issues with. I think > > it is down to lack of experience / knowledge / familiarity with > > commercial strength application. > > > > I use Netbeans 12.6 (Apache loyalty!) on Windows 10 for all my Java > > development using JDK 17. > > > > 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). > > > > 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. > > > > 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. > > > > I appear to have issues with the other two folders > > ‘C:\Community\Tomcat\tomcat-main\webapps\docs\appdev\sample\src\mypackage’ > > 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. > > Try this: > > 1. Close the project in NetBeans > 2. On the command-line, go to the directory where your Tomcat git > checkout is > 3. Run "ant ide-netbeans" > 4. Open the project again in Netbeans > > See if that improves anything. That ant target configures Netbeans in a > way that should be "helpful". I don't use Netbeans myself, but the > equivalent for Eclipse (ide-eclipse) sets up the build-path and lots of > other goodies. > > > 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. > > You can speed-up the unit tests by throwing more CPU cores at it; by > default it uses just one. You can do that by adding this to > build.properties in the same directory as the build.xml file: > > test.threads=n > > That n should be something ... reasonable. I have a 6-core hyperthreaded > CPU (=12 logic CPUs) and setting the number of threads to 4 > significantly reduces the time to run the whole test-suite. I wouldn't > set this to anything higher than the number of physical cores you > actually have unless you don't want to use your computer for anything > else during that test. > > As for test failures, some of them are known to fail in certain > environments. Do you have a list of the tests which fail? Do you know > how to get that list? > > I have an automated build-test-etc script[1] that performs this little > gem after the unit tests have run: > > grep "\(Failures\|Errors\): [^0]" > "${BASE_SOURCE_DIR}/output/build/logs/"TEST*.txt > > That should tell you which tests have failed. Feel free to post them > here and we'll let you know if any of them are concerning. > > > 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. > > If you can run the unit tests, then they are compiling and you should be > able to build a binary release (ant deploy) without a problem. > > > 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. > > > > [Run – Tomcat 8.0] > > No build target is associated with Run action. > > The free-form project requires a target > > Representing the Run action to invoke in > > Your Ant script. Select the target to invoke. > > [Dropdown with lots of tasks v] > > This might be solved by running "ant ide-netbeans". Or maybe not. You > may have to pick a target. The "deploy" target is probably the one you > want, or maybe "compile". Running ant from within an IDE only makes > sense if you know what you are trying to accomplish, just like when > running Maven. Maybe you just want a compile (mvn compile / ant > compile), but maybe you want a JAR file to come out (ant jar/mvn package). > > > Is there an alternative document I should be reviewing to get me to > > actually run Tomcat from within 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. > > > > While I would enjoy the challenge of reviewing the existing sources > > and attempting to incorporate a delay, I may waste more peoples time > > trying to get off the starting blocks. If that is the case, then I can > > raise a bug for future inclusion although it will be a > > pain-in-the-neck having to keep shutting down Tomcat after each > > compile! > > Honestly, this community is all about getting people involved. We are > happy to help you get up and running. How else do you think new > committers are added to the project? > > -chris > > [1] > https://github.com/ChristopherSchultz/apache-tomcat-stuff/blob/master/bin/test-tomcat-release.sh > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org >
--------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org