Server code ( including all the custom java classes ) needs to be with in the same project. Because while building WAR file java files are also needs to be builded. ( you can rename the war file to zip file and see the java class files)
What you actually wants to try?