I am new to OSGI.I have been having trouble to get OSGI-INF folder in generated jar file.
I need to have folder structure like as below
META-INF
OSGI-INF
Com.mine.cq
I am using Eclipse and m2e plugin. When I run my project I am getting BUILD SUCCESS. And I am getting the below folder structure in that generated jar file.
META-INF
Com.mine.cq
Here is my 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>
<groupId>com.mine.cq</groupId>
<artifactId>mineCore</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>mineCore</name>
<url>http://maven.apache.org</url>
<properties>
<file.encoding>utf-8</file.encoding>
</properties>
<build>
<defaultGoal>install</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.0-alpha-3</version>
<executions>
<execution>
<id>enforce-java</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<message>Project must be built with Maven 2.0.7 or higher</message>
<version>2.0.7</version>
</requireMavenVersion>
<requireJavaVersion>
<message>Project must be compiled with Java 5 or higher</message>
<version>1.5.0</version>
</requireJavaVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>1.4.3</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Export-Package>
com.mine.cq.mineCore.*
</Export-Package>
<Import-Package>
*;resolution:=optional,
javax.servlet;version=2.4,
javax.servlet.http;version=2.4
</Import-Package>
<Embed-Dependency>
</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
<Include-Resource>{maven-resources}</Include-Resource>
<Sling-Bundle-Resources>/var/classes</Sling-Bundle-Resources>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin</artifactId>
<version>1.0</version>
<configuration>
<goals>install</goals>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Why OSGI-INF folder is not in the .jar file? I need to set some information in OSGO-INF folder since I have to register my component as a OSGI service.
Please guide me to get it done.
Although being pretty late, I'll post my 2 cents about this issue for future reference.
As already pointed out, you can have the "packaging" of the bundle set to "jar" if you follow the instructions given in Maven bundle plugin documentation.
There is just a little gotcha: with that configuration, you need to explicitly add <exportScr>true</exportScr> inside the plugin configuration in order to properly create the SCR xml file (also remember to adjust manifest location, since in the documentation that piece is absent!).
You can see an example here (that's totally different from yours, but I assume you can easily reduce it on your code, if you're still interested):
<?xml version="1.0" encoding="UTF-8"?>
<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>com.massimobono.karaf.examples</groupId>
<artifactId>user-example</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<build>
<plugins>
<plugin>
<!-- Here you specifiy that you want to use the manifest file generated by maven bundle plugin -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
<!-- Here you generate the whole MANIFEST by using maven-bundle-plugin -->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>3.2.0</version>
<extensions>true</extensions> <!-- make sure this is present -->
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
<configuration>
<manifestLocation>${project.build.outputDirectory}/META-INF/</manifestLocation> <!-- make sure this is present! in the example of maven bundle plugin documentation, this piece is NOT present -->
<exportScr>true</exportScr> <!-- be sure to add this line as well -->
<supportedProjectTypes>
<supportedProjectType>jar</supportedProjectType>
<supportedProjectType>bundle</supportedProjectType>
<supportedProjectType>war</supportedProjectType>
</supportedProjectTypes>
<instructions>
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
<_dsannotations>*</_dsannotations>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>6.0.0</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.osgi/org.osgi.service.component.annotations -->
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.service.component.annotations</artifactId>
<version>1.3.0</version>
</dependency>
</dependencies>
</project>
Your pom.xml needs to have a packaging type of "bundle" rather than "jar". If you want the packaging type to be "jar", use this:
http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html#ApacheFelixMavenBundlePlugin%28BND%29-AddingOSGimetadatatoexistingprojectswithoutchangingthepackagingtype
EDIT: Oh! That's only problem one. The other problem is that I don't think you can generate
OSGI-INF with the maven-bundle-plugin. You need to create the OSGI-INF folder yourself within src/main/resources or use a plugin that generates OSGI-INF.
The maven-scr-plugin can generate OSGI-INF, but it's only useful if you are using SCR. Maven SCR Plugin - Not generating OSGI-INF folder
Related
I have created a simple maven project of Scala in eclipse's scala ide using below details -
Artifact Id - scala-archetype-simple
Group Id - net.alchim31.maven
After created the project I have modified the pom.xml file.
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.test</groupId>
<artifactId>scalapoc</artifactId>
<version>0.0.1</version>
<name>${project.artifactId}</name>
<description>Test scala app</description>
<properties>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
<encoding>UTF-8</encoding>
<scala.version>2.11.5</scala.version>
<scala.compat.version>2.11</scala.compat.version>
</properties>
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala.version}</version>
</dependency>
<!-- Test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.specs2</groupId>
<artifactId>specs2-core_${scala.compat.version}</artifactId>
<version>2.4.16</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.specs2</groupId>
<artifactId>specs2-junit_${scala.compat.version}</artifactId>
<version>2.4.16</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_${scala.compat.version}</artifactId>
<version>2.2.4</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/scala</sourceDirectory>
<testSourceDirectory>src/test/scala</testSourceDirectory>
<plugins>
<plugin>
<!-- see http://davidb.github.com/scala-maven-plugin -->
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
<configuration>
<args>
<!-- <arg>-make:transitive</arg> -->
<arg>-dependencyfile</arg>
<arg>${project.build.directory}/.scala_dependencies</arg>
</args>
<archive>
<manifest>
<mainClass>App.scala</mainClass>
</manifest>
</archive>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<useFile>false</useFile>
<disableXmlReport>true</disableXmlReport>
<!-- If you have classpath issue like NoDefClassError,... -->
<!-- useManifestOnlyJar>false</useManifestOnlyJar -->
<includes>
<include>**/*Test.*</include>
<include>**/*Suite.*</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</project>
I have also added manifest entry inside plugin tag.
<archive>
<manifest>
<mainClass>App.scala</mainClass>
</manifest>
</archive>
I have only one App.scala file and one test file available in project. Build was successful. But when trying to execute the jar using java -jar <jar_name> getting below error -
no main manifest attribute, in scalapoc-0.0.1.jar
When trying to execute the command java -cp scalapoc-0.0.1.jar com.test.scalapoc.App.scala getting below error -
Error: Could not find or load main class com.test.scalapoc.App.scala
Please suggest what to be needed to execute the jar.
try
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>com.test.scalapoc.App</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
.scala is for source only, source is not executable
archive tag is part of the configuration of a plugin
see https://maven.apache.org/shared/maven-archiver/examples/classpath.html#Make
UPDATE 2018-06-05:
To create a standalone jar (without need to defined a classpath with scala-library and other dependencies on command line), you should create a jar that included other classes/jar.
see:
Apache Maven Shade Plugin – Executable JAR and the rest of the doc of the plugin for tuning & configuration
or the old one-jar tool Deliver Your Java Application in One-JAR™ !
In a Spring Boot based project of mine I want to create two different builds from the same project.
The decision on which build is generated should come from a maven profile.
I want to create one build (full) which includes a certain folder src/main/java/com/example/demo/full and a certain dependency, and a second build (default or light) build which does not include them.
Including the dependencies for build full works, but I don't know how to make sure the folder src/main/java/com/example/demo/full is only compiled for the full build.
Here my pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<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>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.3.RELEASE</version>
</parent>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<build>
<finalName>demo</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<useSystemClassLoader>false</useSystemClassLoader>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>full</id>
<dependencies>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.16</version>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
How can I manage to have the mentioned source-folder only compiled for profile full?
Add a second src folder like scr\foo and then add a profile in maven configure this src folder.
<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">
<build>
...
</build>
<profiles>
<profile>
<id>extraSource</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>src/foo/</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
Here the source folder is added using the Build Helper Plugin plugin for maven. As it is embedded in the build section of the specific profile, it is only active while executing maven with this profile (see the activation section)
there are problem with disabling one of your maven-source-plugin if this dependency is a part of parent which you cant not give ID to, ill recomend to use phase none with this code to one of your pom.xml files that will disable this.
I also recommend to use command: mvn -Prelease-profile help:effective-pom
to print if you have two of dependencies maven-source-plugin in your code, if yes, disable one of them with this code below:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
I can't use the scala-maven-plugin to build my Java-sources due to a bug in Scalac (https://issues.scala-lang.org/browse/SI-9853).
Splitting the build so that Java is compiled by the maven-compiler-plugin and Scala by the scala-maven-plugin was easy enough with the sources residing in src/main/java and src/main/scala.
Right now I am running into the problem that the Scala-classes can't see the Java-classes.
When doing mvn clean compile I get 'not found' for all Java-classes required by the Scala-classes. Checking 'target/classes' shows that the Java-classes are there.
I tried moving the Scala-build to different phases but the results remain the same.
How can I make the Scala-build see the classes already available in target/classes?
<?xml version="1.0" encoding="UTF-8"?>
<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>de.codepitbull.maven</groupId>
<artifactId>maven-scalac-bug</artifactId>
<version>3.4.0-SNAPSHOT</version>
<name>Scalac + Javac</name>
<properties>
<scala.version>2.11.8</scala.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala.version}</version>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-compiler</artifactId>
<scope>provided</scope>
<version>${scala.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.2.2</version>
<configuration>
<sendJavaToScalac>false</sendJavaToScalac>
<args>
<arg>-target:jvm-1.8</arg>
<arg>-feature</arg>
<arg>-deprecation</arg>
<arg>-explaintypes</arg>
<arg>-unchecked</arg>
<arg>-Xlint</arg>
</args>
</configuration>
<executions>
<execution>
<id>java-compile-first</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
The easiest workaround would be to split it into two submodules. That way you're able to reference the Java classes as dependency. After that generate an Uber jar or shaded jar with both modules inlined.
We are using maven profile to build a jar specific to tomcat.
<profile>
<id>TOMCAT</id>
<build>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>default-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<finalName>${project.artifactId}-tomcat-${project.version}</finalName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-core</artifactId>
<version>5.7.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-j2ee-management_1.1_spec</artifactId>
<version>1.0.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jboss.javaee</groupId>
<artifactId>jboss-jms-api</artifactId>
<version>1.1.0.GA</version>
</dependency>
</dependencies>
</profile>
My expectation is to create a single jar with name acme-tomcat-0.0.1-SNAPSHOT.jar but on building the project, maven is generating another one (a default one) acme-0.0.1-SNAPSHOT.jar. How can we avoid the generation of the second one (acme-0.0.1-SNAPSHOT.jar)?
Thanks
I've only used Maven a few times to build projects, and I've generated WARs for Tomcat instead of JARs, but the process should be similar.
My build looks like this:
<build>
<finalName>sb</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
The header at the top goes like this:
<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>org.majisto.socialbusiness</groupId>
<artifactId>socialbusiness</artifactId>
<version>0.0.2</version>
<packaging>war</packaging>
<name>socialbusiness</name>
I imagine if you switch the packaging row to JAR you should get one JAR file out of it. The finalName in the build determines the filename and I think where you have it might be the confusing part to Maven. Let me know if you have any other questions. Maven made working with Spring so much easier. Are you using "maven package" in the CLI?
By changing the build section in the profile section from
<build>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>default-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<finalName>${project.artifactId}-tomcat-${project.version}</finalName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
to
<build>
<finalName>${project.artifactId}-tomcat-${project.version}</finalName>
</build>
helped me to solve this issue
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.
I went to https://java.net/projects/swingx/downloads/directory/releases
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?)
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?
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.