java scala

Maven

Download artefacts in dedicated repository

Some software (such spark) need to have jars in local. Maven is a nice way to synchronize nexus and a given repository.

This maven plugin allow to export the dependencies into the outputDirectory. Moreover it can strip the version.

        <profile>
            <id>default</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-dependency-plugin</artifactId>
                            <version>3.1.2</version>
                            <executions>
                                <execution>
                                    <id>get-package</id>
                                    <phase>package</phase>
                                    <goals>
                                        <goal>copy-dependencies</goal>
                                    </goals>
                                    <configuration>
                                        <outputDirectory>${project.build.directory}/dependencies/</outputDirectory>
                                        <stripVersion>true</stripVersion>
                                    </configuration>
                                </execution>
                            </executions>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>

It is then possible to specify the lastest version of a given dependency and produce a striped version accessible from a given folder.

    <properties>
	    <spark-etl.version>[1.0.10,)</spark-etl.version>
        <omop-spark.version>[1.0.1,)</omop-spark.version>
    </properties>
	
	    <dependencies>

        <dependency>
            <groupId>io.frama.parisni</groupId>
            <artifactId>spark-csv</artifactId>
            <version>${spark-etl.version}</version>
            <classifier>shaded</classifier>
            <exclusions>
                <exclusion>
                    <groupId>*</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

	    </dependencies>

The dependency can be produced by using the below command:

mvn -P "default,snapshot" package \
-Dmaven.wagon.http.ssl.insecure=true \ # those are used because of ssl problems on my side...
-Dmaven.wagon.http.ssl.allowall=true \
-Dmaven.wagon.http.ssl.ignore.validity.dates=true

Configure jdks

<toolchains xmlns="http://maven.apache.org/TOOLCHAINS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://maven.apache.org/TOOLCHAINS/1.1.0 http://maven.apache.org/xsd/toolchains-1.1.0.xsd">
 <!-- JDK toolchains -->
 <toolchain>
   <type>jdk</type>
   <provides>
     <version>1.8</version>
     <vendor>sun</vendor>
   </provides>
   <configuration>
     <jdkHome>/opt/java8</jdkHome>
   </configuration>
 </toolchain>
 <toolchain>
   <type>jdk</type>
   <provides>
     <version>1.7</version>
     <vendor>sun</vendor>
   </provides>
   <configuration>
     <jdkHome>/opt/java7</jdkHome>
   </configuration>
 </toolchain>
</toolchains>

React ?

This page was last modified: