Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JRE 1.6 in Maven repository (public or private)

Tags:

java

maven

is there JRE 1.6 available in some public Maven repository we could proxy in our Nexus?

if not, can somebody please provide a hint on how to deploy JRE to a Maven repository?

like image 899
Alex Avatar asked Dec 16 '11 21:12

Alex


People also ask

What is private Maven repository?

Private repositories restrict access of your private artifacts to authorized individuals. Just like public repositories, private repositories allow read and write access to your private artifacts via any apache maven compatible tool or HTTPS client.

Where can I find maven repository?

Maven central repository is located on the web. It has been created by the apache maven community itself. The path of central repository is: http://repo1.maven.org/maven2/. The central repository contains a lot of common libraries that can be viewed by this url http://search.maven.org/#browse.


1 Answers

here's the solution I found:

  • Zip the JREs (jre-linux32-1.6.0.23.zip and jre-jre-win32-1.6.0.zip in my case).
  • Upload them to your Nexus repository through web UI (or deploy manually with "mvn"), set the artifact parameters: groupid="oracle" artifactid="jre-win32" / "jre-linux32", set the right version and packaging type "zip".
  • modify your pom.xml to download and unzip the dependency during the build (I bound it to "prepare-package" phase).

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.4</version>
                <executions>
                    <execution>
                        <id>copy</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>oracle</groupId>
                                    <artifactId>jre-win32</artifactId>
                                    <version>1.6.0.23</version>
                                    <type>zip</type>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${project.build.directory}/alternateLocation</outputDirectory>
                                    <!--<destFileName>optional-new-name.jar</destFileName>-->
                                </artifactItem>
                                <artifactItem>
                                    <groupId>oracle</groupId>
                                    <artifactId>jre-linux32</artifactId>
                                    <version>1.6.0.23</version>
                                    <type>zip</type>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${project.build.directory}/alternateLocation</outputDirectory>
                                    <!--<destFileName>optional-new-name.jar</destFileName>-->
                                </artifactItem>
                            </artifactItems>
                            <outputDirectory>${project.build.directory}/wars</outputDirectory>
                            <overWriteReleases>false</overWriteReleases>
                            <overWriteSnapshots>true</overWriteSnapshots>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    

that's it. The JRE will be downloaded and extracted to target\alternateLocation folder.

you can use "copy" goal instead of "unpack" if you want to only copy the ZIP files without extracting them.

like image 165
Alex Avatar answered Oct 04 '22 14:10

Alex