redhat-developer / redhat-developer/vscode-java
build-helper-maven-plugin on profile doesn't work
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 546
- Avg merge
- 20h 1m
- Merged PRs (30d)
- 11
Description
[provide a description of the issue]
Dear support,
I am trying to use the profiles in a POM to add extra source directory.
I am using a plugin which generate java code in a custom directory target/generated-sources/plc4x and for telling VSC that this directory has sono code I would like to use build-helper-maven-plugin.
If I use the plugin inside the POM it works:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>target/generated-sources/plc4x</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
In this way VSC add correctly the new directory in the .classpath file:
<classpathentry kind="src" output="target/classes" path="target/generated-sources/plc4x">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
but if I try to use profiles to handle the plugin just in some circumstances, it doesn't work:
<profiles>
<profile>
<id>vsc</id>
<activation>
<os>
<family>mac</family>
</os>
</activation>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>target/generated-sources/plc4x</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
</profiles>
In this way the entry in the .classpath file is not present.
Environment
- Operating System: Mac Os 11.2
- JDK version: openjdk version "13.0.2" 2020-01-14
- Visual Studio Code version: 1.53.0
Current Result
I can't use profiles to handle the build-helper-maven-plugin
Expected Result
To have the the path entry in the classpath in both the situation
Regards,
Stefano Bossi
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the two POM configurations on macOS with the listed JDK and VS Code versions, comparing the generated .classpath entry when build-helper-maven-plugin is under build versus an OS-activated profile. Start with Maven profile handling and VS Code Java project import; done means the generated-source path appears in .classpath in both reported situations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, vscode
- Domain
- build-system, developer-experience
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100