2

I have a maven project in IntelliJ I have marked the generated sources directory as the source by doing Files>Project Structure and marking as source. I've also done it the other way by right clicking on the folder and marking as generated-sources.

I'm still getting errors saying the IntelliJ cannot find things in these folders Cannot resolve symbol 'name_of_folder' when I'm creating a SOAP implementation

Does anyone know how I can fix this issue? From what I can see I have done everything correctly to mark that folder and IntelliJ Should be able to read from there

7
  • 1
    Maybe this will be of some help to you. SO Question You may have to re-import the project. View -> Tool Windows -> Maven Projects, then click on cycle arrows icon Commented Jul 17, 2017 at 11:33
  • See confluence.jetbrains.com/display/IDEADEV/… Commented Jul 17, 2017 at 11:38
  • @CrazyCoder My folders are there that's not the issue. When I mark it as source intellij doesn't seem to know about it Commented Jul 17, 2017 at 11:43
  • Please share the Minimal, Complete, and Verifiable example. Commented Jul 17, 2017 at 11:43
  • @CrazyCoder my explanation is fine, there is nothing else I can say to make it clear.... Commented Jul 17, 2017 at 11:46

3 Answers 3

2

uncheck "Create Separate module per source set" in Preferences > Build, Execution, Deployment > Gradle and then rebuild / gradle refresh

Sign up to request clarification or add additional context in comments.

Comments

0

Fixed this error....

IntelliJ was marking all subdir of my generated-sources/cxf folder as source roots... So a simple highlight of all folders and un-mark as sources fixes the issue.

Comments

0

I had a similar situation where I had to generate a Java class from the script through the pom.xml file. Even after I could see that the Java class was generated successfully after compiling the package, I mentioned I was not able to import that generated Java class and use it any other class.

Since this took much of my time to resolve the issue and I could not find any proper answers, I'm posting the steps I performed so that it could be a help to anyone in the future with similar issues.

  1. First mark the generated source directory as the source by going to File ->Project Structure -> modules. Click on the Source tab and add your generated folder as source.

  2. Right click on the folder under generated source folder and select mark directory as -> Generated sources root

  3. Use this plugin so that generated class can be imported to any other class.

<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <version>3.0.0</version> <executions> <execution> <id>add-java-source</id> <phase>generate-sources</phase> <goals> <goal>add-source</goal> </goals> <configuration> <sources> <source>${project.build.directory}/generated-sources/{folderUnderGeneratedSrcFolder} </source> </sources> </configuration> </execution> </executions> </plugin>

Hope this helps!!!!!

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.