I am new to Gradle, so there is a chance that I have missed something obvious here. I am working on using Gradle to automatically build our projects. I have dealt with most of them, but one of them causes me endless troubles. Since this is for my company, I cannot use any real code, but I will do my best to provide realistic pseudocode.
I am trying to compile a web application with flex front-end and java interface. Right now, I am focusing solely on creating a .war file with java in it, then I will go into flex compilation. When I run the following build.gradle script, it gives me countless "don't find character" errors.
apply plugin: 'eclipse' apply plugin: 'war' sourceCompatibility = 1.6 repositories { mavenCentral() } sourceSets.main.java.srcDir 'src' sourceSets.main.resources.srcDir 'src' webAppDirName = "WebContent" war.archiveName "Gradle_test.war" dependencies { compile fileTree(dir: 'WebContent/WEB-INF/lib', include: '*.jar') providedCompile 'org.apache.tomcat:catalina:6.0.13' providedCompile 'org.apache.tomcat:dbcp:6.0.13' }
An example of errors that occurred (with fake package and class names):
/Users/user/Documents/eclipse/ProjectName/src/com/companyName/teamName/projectName/core/release/subProjectName/projectVersion/RenamedObject.java:385: cannot find symbol symbol : class OtherObject location: class com.companyName.teamName.projectName.core.release.subProjectName.projectVersion.RenamedObject public class InnerClass extends OtherObject implements Indexable<String>, Serializable {
The InnerClass class is declared in the RenamedObject.java file along with the RenamedObject class. The character that he cannot find, OtherObject, not from .jar. This is the source file stored in /Users/user/Documents/eclipse/ProjectName/src/com/companyName/teamName/projectName/core/release/subProjectName/projectVersion/superTypes/OtherObject.java . The object is imported at the top of RenamedObject.java and can be correctly created and launched via eclipse without any special settings. These errors occur during the task: compileJava after executing gradle war from the terminal.
Is there a reason Gradle will have a problem handling import source code from a subpackage like this? Am I just doing something wrong? Let me know if there is any additional information that might help, and I provided it if I can.
EDITOR: I have earned. All 130 errors were resolved with one change. If I add the full name of the package to OtherObject in extends, it looks like this:
public class InnerClass extends com.companyName.teamName.projectName.core.release.subProjectName.projectVersion.superTypes.OtherObject implements Indexable<String>, Serializable {
This one change made it all work, but I still don't understand the reason. This is not the only reference to OtherObject in the project, and it is not the only place where the inner class extends the class defined in another source package.