1

Here is my Project structure.

Note:Project-B depends on Project-A Build

enter image description here

I have following attributes in SamplePage.Java

Project-A->SamplePage.Java

public string name;
  public int age;

Project-B->SamplePage.Java

public string name;

I have a Xtend class that will refer Project-B SamplePage.java class and it failed the build throwing The method or field age is undefined for the type SamplePage.java.Execution failed for task ':Project-B:generateXtext'.If i put age attribute to Project-B SamplePage.java it builds successfully.My question is that how can i over come that problem?Not sure if i did some mistake in build script file.

Build.Gradle

allprojects  {
  apply plugin: 'java'
  apply plugin: 'maven'
  apply plugin: 'eclipse'
  apply plugin: 'org.xtext.xtend'
}

subprojects {
  apply plugin: 'java'
  sourceCompatibility = JavaVersion.VERSION_1_8
  targetCompatibility = JavaVersion.VERSION_1_8

eclipse {
      project {
        natures 'org.eclipse.xtext.ui.shared.xtextNature'
        buildCommand 'org.eclipse.xtext.ui.shared.xtextBuilder'
      }
    } 

}

etc...
gihan-maduranga
  • 4,381
  • 5
  • 41
  • 74

0 Answers0