如何下载和编译SwingX

Rub*_*uby 4 java swing swingx maven

这必须主要是一个新手Maven问题.

由于SwingX迁移到Kenai,整个网站都有警告,许多链接都被破坏了......所以这是我最好的尝试.

  1. 我去了https://java.net/projects/swingx/downloads/directory/releases
  2. 点击"SwingX 1.6.4 All - Sources"(对我来说真的是一个非直观的,命中或错过的选择,但也许这是其他人理解的命名约定?)
  3. 这下载swingx-all-1.6.4-sources.jar(为什么它甚至是一个罐而不是一个拉链?)

但是,此源jar不包含POM.XML.

所以,我从同一个链接下载了swingx-all-1.6.4.jar,将其重命名为.zip,充气.它确实包含META-INF\maven\org.swinglabs.swingx\swingx-all\POM.XML:

<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>
  <parent>
    <artifactId>swingx-project</artifactId>
    <groupId>org.swinglabs.swingx</groupId>
    <version>1.6.4</version>
    <relativePath>../pom.xml</relativePath>
  </parent>
  <artifactId>swingx-all</artifactId>
  <packaging>jar</packaging>
  <name>SwingX Complete</name>
  <description>A Maven project to aggregate all modules into a single artifact.</description>
  <properties>
    <project.generatedDependencies>${project.generatedSourcesDirectoy}/dependencies</project.generatedDependencies>
  </properties>
  <!-- make the dependent swingx modules optional, since we're aggregating -->
  <dependencies>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>swingx-graphics</artifactId>
      <version>${project.version}</version>
      <type>jar</type>
      <scope>compile</scope>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>swingx-core</artifactId>
      <version>${project.version}</version>
      <type>jar</type>
      <scope>compile</scope>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>swingx-mavensupport</artifactId>
      <version>${project.version}</version>
      <type>jar</type>
      <scope>compile</scope>
      <optional>true</optional>
    </dependency>
  </dependencies>
  <profiles>
    <profile>
      <id>jvnet-release</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.4</version>
            <executions>
              <execution>
                <id>src-dependencies</id>
                <phase>generate-sources</phase>
                <goals>
                  <goal>unpack-dependencies</goal>
                </goals>
                <configuration>
                  <classifier>sources</classifier>
                  <includeGroupIds>${project.groupId}</includeGroupIds>
                  <excludeArtifactIds>swingx-mavensupport</excludeArtifactIds>
                  <failOnMissingClassifierArtifact>false</failOnMissingClassifierArtifact>
                  <outputDirectory>${project.generatedDependencies}</outputDirectory>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <version>1.4</version>
            <executions>
              <execution>
                <id>add-dependencies-source</id>
                <phase>generate-sources</phase>
                <goals>
                  <goal>add-source</goal>
                </goals>
                <configuration>
                  <sources>
                    <source>${project.generatedDependencies}</source>
                  </sources>
                </configuration>
              </execution>
              <execution>
                <id>add-dependencies-resource</id>
                <phase>generate-resources</phase>
                <goals>
                  <goal>add-resource</goal>
                </goals>
                <configuration>
                  <resources>
                    <resource>
                      <directory>${project.generatedDependencies}</directory>
                      <excludes>
                        <exclude>**/*.java</exclude>
                      </excludes>
                    </resource>
                  </resources>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <configuration>
              <archive>
                <manifestFile>${project.generatedAnnotations}/META-INF/MANIFEST.MF</manifestFile>
              </archive>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
Run Code Online (Sandbox Code Playgroud)

当我更改到上面的POM.XML所在的目录并执行mvn安装时,它肯定会构建很多东西......但是也说:

[INFO]跳过不存在的resourceDirectory F:\ swingx\swingx-all-1.6.4\META-INF\m Maven\org.swinglabs.swingx\swingx-all\src\main\resources

那是因为src目录不存在.这是有道理的,因为有问题的.jar文件据说只是二进制文件,但我希望Maven目标可以下载源代码等等......如果它只是二进制文件,为什么需要构建它?困惑.

那时,我可能要么将src目录从第一个zip文件复制到第二个,或者将pom.xml从第二个文件复制到第一个...但我感觉我错过了一些东西,并且有是一种更直接的方式.

顺便说一句,在同一个网页上有第三个文件,swingx-mavensupport-1.6.4.jar

所以我下载了它,将其重命名为.zip,膨胀,找到了这个文件:META-INF\maven\org.swinglabs.swingx\swingx-mavensupport\POM.XML:

<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>
  <parent>
    <artifactId>swingx-project</artifactId>
    <groupId>org.swinglabs.swingx</groupId>
    <version>1.6.4</version>
    <relativePath>../pom.xml</relativePath>
  </parent>
  <artifactId>swingx-mavensupport</artifactId>
  <name>SwingX Maven Support</name>
</project>
Run Code Online (Sandbox Code Playgroud)

更改为其目录并运行mvn.install

然而,由于缺乏大量文件而抱怨.

我一定是弄错了.什么是正确的方法?

Jk1*_*Jk1 6

使用以下URL进行SVN签出:https://svn.java.net/svn/swingx~svn.在主干中有一个正确的pom.xml文件(实际上很多文件用于不同的工件),因此您可以自己轻松地构建项目.

swingx-all-1.6.4-sources.jar(为什么它甚至是罐子而不是拉链?)

这是源代码在Maven中打包和分发的默认方式.