redhat-developer / redhat-developer/vscode-java

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

Offen
#1,800 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
TypeScript
Sterne
2.3k
Forks
547
Ø Merge
20 Std. 1 Min.
Gemergte PRs (30 T.)
11

Beschreibung

[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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Reproduziere die beiden POM-Konfigurationen unter macOS mit den aufgeführten JDK- und VS Code-Versionen und vergleiche den generierten .classpath-Eintrag, wenn sich build-helper-maven-plugin unter build beziehungsweise in einem OS-aktivierten Profil befindet. Beginne mit der Maven-Profilbehandlung und dem Import von Java-Projekten in VS Code; als abgeschlossen gilt die Aufgabe, wenn der Pfad zu den generierten Quellen in .classpath in beiden beschriebenen Situationen erscheint.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
java, vscode
Bereich
build-system, developer-experience
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.