redhat-developer / redhat-developer/vscode-java

build-helper-maven-plugin on profile doesn't work

オープン
#1,800 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
TypeScript
スター
2.3k
フォーク
547
平均マージ
20時間 1分
マージ済み PR(30日)
11

説明

[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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

記載されている JDK および VS Code のバージョンを使用して macOS 上で 2 つの POM 構成を再現し、build-helper-maven-plugin が build 配下にある場合と、OS によって有効化されるプロファイルにある場合の、生成される .classpath エントリを比較します。まず Maven のプロファイル処理と VS Code による Java プロジェクトのインポートから始めます。完了条件は、報告されている両方の状況で生成されたソースのパスが .classpath に現れることです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java, vscode
領域
build-system, developer-experience
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。