redhat-developer / redhat-developer/vscode-java

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

Đang mở
#1,800 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
TypeScript
Star
2.3k
Fork
547
Merge trung bình
20 giờ 1 phút
Pull request đã merge (30 ngày)
11

Mô tả

[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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Tái hiện hai cấu hình POM trên macOS với các phiên bản JDK và VS Code được liệt kê, so sánh mục .classpath được tạo ra khi build-helper-maven-plugin nằm dưới build và khi nó nằm trong một profile được kích hoạt theo hệ điều hành. Bắt đầu với việc xử lý profile của Maven và việc nhập dự án Java vào VS Code; được xem là hoàn tất khi đường dẫn nguồn đã tạo xuất hiện trong .classpath ở cả hai tình huống được báo cáo.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
java, vscode
Lĩnh vực
build-system, developer-experience
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.