Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to download and compile SwingX

This must be mostly a newbie Maven question.

Since SwingX migrated to Kenai, there are warnings all over the website that many links are broken.. so here is my best attempt.

  1. I went to https://java.net/projects/swingx/downloads/directory/releases
  2. Clicked on "SwingX 1.6.4 All - Sources" (really a non-intuitive, hit-or-miss choice for me, but perhaps it's a naming convention other people understand?)
  3. This downloads swingx-all-1.6.4-sources.jar (why is it even a jar and not a zip?)

However, this source jar does not contain POM.XML.

So, I downloaded swingx-all-1.6.4.jar from the same link, renamed it to .zip, inflated. It does contain 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>

When I change to the above directory where POM.XML is located and do mvn install, it certainly builds a lot of stuff.. but also says:

[INFO] skip non existing resourceDirectory F:\swingx\swingx-all-1.6.4\META-INF\m Maven\org.swinglabs.swingx\swingx-all\src\main\resources

That's because the src directory is nonexistent. Which makes sense, because the .jar files in question is said to be binaries only, but I was hoping some Maven target would download sources or something... and if it's binary only, why does it need to be built? Confused.

At that point, I could probably either copy the src directory from the first zip file to the second, or copy the pom.xml from the second file to the first.. but I am having a feeling I am missing something, and there has to be a more straightforward way.

BTW, there is a third file at the same web page, swingx-mavensupport-1.6.4.jar

So I downloaded that, renamed it to .zip, inflated, found this file: 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>

Changed to its directory and ran mvn.install

However, that complained at the lack of a whole lot of files.

I must be getting it all wrong. What's the right way?

like image 893
Irina Rapoport Avatar asked Oct 05 '13 18:10

Irina Rapoport


1 Answers

Use the following URL for SVN checkout: https://svn.java.net/svn/swingx~svn. In trunk there is a correct pom.xml file (actualy many of them for different artifacts), so you can easily build the project yourself.

swingx-all-1.6.4-sources.jar (why is it even a jar and not a zip?)

That's the default way sources are packaged and distributed in Maven.

like image 95
Jk1 Avatar answered Nov 08 '22 10:11

Jk1