Closed akshay-tamhane closed 3 months ago
Conventionally these should be placed in a package root which is a subdirectory of target/generated-sources
(or target/generated-test-sources
in the case of test
scope); for example target/generated-sources/stuff-from-my-maven-plugin/com/mycorp/SomeClass.java
.
Hey @akshay-tamhane, There is a plugin that you need to add in your pom.xml with appropriate configurations. I have attached a example snippet which should work most probably (atleast it is working for me currently).
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.6.0</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>src/gen/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Closing this issue for now, feel free to reopen this issue if you have any more queries.
I would really recommend use of target/generated-sources/<somedir>/
instead. This follows Maven conventions, works with mvn clean
, and will be honored automatically by the IDE.
In a maven project, there are generated java files which are present in a folder called "gen" other than the "main" folder, under the src folder. However, these packages are not detected by this extension and gives an error "package does not exist". Is there any way to make this work for code completion/navigation by marking the "gen" folder as one of the source packages?