Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/338.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java POM依赖关系中的变量。maven如何知道SWT的工件id?_Java_Eclipse_Maven - Fatal编程技术网

Java POM依赖关系中的变量。maven如何知道SWT的工件id?

Java POM依赖关系中的变量。maven如何知道SWT的工件id?,java,eclipse,maven,Java,Eclipse,Maven,piccolo2d swt的相关性描述如下 如何解决这个问题?它把变量的值带到哪里 如果我使用此依赖项运行空项目,它会显示一些错误消息,其中提到org.eclipse.swt.win32 它从哪里得到这个值 如果我打印出这些变量的值,我什么也得不到 POM在这里 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schema

piccolo2d swt
的相关性描述如下

如何解决这个问题?它把变量的值带到哪里

如果我使用此依赖项运行空项目,它会显示一些错误消息,其中提到
org.eclipse.swt.win32

它从哪里得到这个值

如果我打印出这些变量的值,我什么也得不到

POM在这里

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>Test_DisplayMavenVariables</groupId>
    <artifactId>Test_DisplayMavenVariables</artifactId>
    <version>0.0.1-SNAPSHOT</version>


    <properties>
        <testproperty>This is a test property</testproperty>
    </properties>


    <!--    
    <dependencies>

        <dependency>
            <groupId>org.piccolo2d</groupId>
            <artifactId>piccolo2d-swt</artifactId>
            <version>1.3.1</version>
        </dependency>


    </dependencies>
     -->

    <build>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.1</version>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <echo>Displaying value of some properties</echo>
                                <echo>[testproperty] ${testproperty}</echo>
                                <echo>[swt.artifactId] ${swt.artifactId}</echo>
                                <echo>[swt.groupId] ${swt.groupId}</echo>
                            </tasks>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>


        <pluginManagement>
            <plugins>
                <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.apache.maven.plugins</groupId>
                                        <artifactId>maven-antrun-plugin</artifactId>
                                        <versionRange>[1.1,)</versionRange>
                                        <goals>
                                            <goal>run</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore></ignore>
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

</project>

4.0.0
测试显示变量
测试显示变量
0.0.1-快照
这是一个测试属性
org.apache.maven.plugins
maven antrun插件
1.1
验证
跑
显示某些属性的值
[testproperty]${testproperty}
[swt.artifactId]${swt.artifactId}
[swt.groupId]${swt.groupId}
org.eclipse.m2e
生命周期映射
1.0.0
org.apache.maven.plugins
maven antrun插件
[1.1,)
跑

正在通过中的maven配置文件定义
swt.groupId
swt.artifactId
变量,例如:

<profile>
  <id>windows_x86</id>
  <activation>
    <os>
      <family>windows</family>
      <arch>x86</arch>
    </os>
  </activation>
  <properties>
    <swt.groupId>org.eclipse.swt.win32.win32</swt.groupId>
    <swt.artifactId>x86</swt.artifactId>
  </properties>
</profile>

windows_x86
窗户
x86
org.eclipse.swt.win32.win32
x86

正在为每个平台定义一个配置文件,该配置文件是根据运行maven时检测到的
os.family
os.arch
激活的。

您可以在此处共享日志文件吗..为什么这些变量对antrun不可见?这些属性(变量)是在piccolo2d swt依赖项的pom中定义的,而不是在pom中定义的。如果在pom(或父pom)中的某个位置定义了这些属性,则antrun将显示值。
<profile>
  <id>windows_x86</id>
  <activation>
    <os>
      <family>windows</family>
      <arch>x86</arch>
    </os>
  </activation>
  <properties>
    <swt.groupId>org.eclipse.swt.win32.win32</swt.groupId>
    <swt.artifactId>x86</swt.artifactId>
  </properties>
</profile>