You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by lg...@apache.org on 2019/01/30 12:41:10 UTC

[mina-sshd] 01/03: [SSHD-885] Create source bundle for OSGi JAR

This is an automated email from the ASF dual-hosted git repository.

lgoldstein pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mina-sshd.git

commit 24b2b60589dd84d144a405225eb120e9eb7b4a57
Author: Lyor Goldstein <lg...@apache.org>
AuthorDate: Tue Jan 29 13:27:50 2019 +0200

    [SSHD-885] Create source bundle for OSGi JAR
---
 sshd-osgi/pom.xml | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)

diff --git a/sshd-osgi/pom.xml b/sshd-osgi/pom.xml
index 09c53fb..f6eec74 100644
--- a/sshd-osgi/pom.xml
+++ b/sshd-osgi/pom.xml
@@ -100,6 +100,70 @@
                     </execution>
                 </executions>
             </plugin>
+
+                <!-- We need special build instructions for the sources JAR
+                    since this is a 'shaded' JAR constructed from the already
+                    compiled classes of its component modules -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-antrun-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>create-sources-artifact</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                        <configuration>
+                            <target name="create-sources-artifact-jar" unless="skip.osgi.sources">
+                                <mkdir dir="${project.build.directory}/osgi-sources/META-INF/maven/${project.groupId}/${project.artifactId}" />
+
+                                <copy todir="${project.build.directory}/osgi-sources/META-INF/maven/${project.groupId}/${project.artifactId}">
+                                    <fileset dir="${project.basedir}" includes="pom.xml" />
+                                </copy>
+
+                                <echo file="${project.build.directory}/osgi-sources/META-INF/maven/${project.groupId}/${project.artifactId}/pom.properties">
+#Created by Apache Maven ${maven.version}
+version=${project.version}
+groupId=${project.groupId}
+artifactId=${project.artifactId}
+                                </echo>
+
+                                <jar destfile="${project.build.directory}/${project.artifactId}-${project.version}-sources.jar">
+                                    <fileset dir="${project.basedir}/../sshd-common/src/main/java" includes="**/*" />
+                                    <fileset dir="${project.basedir}/../sshd-common/src/main/resources" includes="**/*" erroronmissingdir="false" />
+                                    <fileset dir="${project.basedir}/../sshd-core/src/main/java" includes="**/*" />
+                                    <fileset dir="${project.basedir}/../sshd-core/src/main/resources" includes="**/*" erroronmissingdir="false" />
+                                    <fileset dir="${project.build.directory}/osgi-sources" includes="META-INF/**/*" />
+                                </jar>
+                            </target>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>attach-source-artifact</id>
+                        <phase>package</phase>
+                        <goals>
+                           <goal>attach-artifact</goal>
+                        </goals>
+                        <configuration>
+                            <artifacts>
+                                <artifact>
+                                    <file>${project.build.directory}/${project.artifactId}-${project.version}-sources.jar</file>
+                                    <type>jar</type>
+                                    <classifier>sources</classifier>
+                                </artifact>
+                            </artifacts>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
         </plugins>
     </build>
 </project>