diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 00000000..71827d09 --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,38 @@ + +## How to be a contributor to this project + +### Are you submitting a pull request? + +* Use [our codestyle](https://github.com/sonatype/codestyle). If we get a PR that doesn't match it, there will be +much shaming throughout the land. If you use an editor besides Eclipse or IntelliJ, adapt the codestyle and submit a PR +there :) +* Fill out a CLA for us, so we can sort out all the legal parts of contributing. You can get all the information for +this [here](https://help.sonatype.com/display/NXRM3/Bundle+Development#BundleDevelopment-ContributingBundles). You may go, this is for your book, is it +applicable for this repo? Yes, absolutely. Follow the CLA process and email in your form. We are working on a way to +make this simpler, as well. +* Make sure to fill out an issue for your PR, so that we have traceability as to what you are trying to fix, +versus how you fixed it. +* Try to fix one thing per pull request! Many people work on this code, so the more focused your changes are, the less +of a headache other people will have when they merge their work in. +* Ensure your Pull Request passes tests either locally or via TravisCI (it will run automatically on your PR) +* Make sure to add yourself or your organization to CONTRIBUTORS.md as a part of your PR, if you are new to the project! +* If you're stuck, ask our [gitter channel](https://gitter.im/sonatype/nexus-developers)! There are a number of +experienced programmers who are happy to help with learning and troubleshooting. + +### Are you new and looking to dive in? + +* Check our issues to see if there is something you can dive in to. +* Come hang out with us at our [gitter channel](https://gitter.im/sonatype/nexus-developers). diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 00000000..7518621f --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,10 @@ +Thanks for creating an issue! Please fill out this form so we can be +sure to have all the information we need, and to minimize back and forth. + +* **What are you trying to do?** + +* **What feature or behavior is this required for?** + +* **How could we solve this issue? (Not knowing is okay!)** + +* **Anything else?** diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..f58eb024 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,15 @@ +(brief, plain english overview of your changes here) + +This pull request makes the following changes: +* (your change here) +* (another change here) +* (etc) + +(If there are changes to the UI, please include a screenshot so we +know what to look for!) + +(If there are changes to user behavior in general, please make sure to +update the docs, as well) + +It relates to the following issue #s: +* Fixes #X diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..cb76ff96 --- /dev/null +++ b/.gitignore @@ -0,0 +1,30 @@ +# Eclipse +.classpath +.project +.settings/ + +# Maven +target/ +*.ser +*.ec +.mvn/timing.properties +.mvn/extensions.xml +.mvn/maven.config + +# Intellij +*.ipr +*.iml +*.iws +.idea/ + +# OrientDB +.orientdb_history + +# Other +.DS_Store +.clover +*.log +/*.rc +atlassian-ide-plugin.xml +dependency-reduced-pom.xml +out diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..dff5f3a5 --- /dev/null +++ b/.travis.yml @@ -0,0 +1 @@ +language: java diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md new file mode 100644 index 00000000..5401606e --- /dev/null +++ b/CONTRIBUTORS.md @@ -0,0 +1,23 @@ + +A lot of awesome people have contributed to this project! Here they are: + +Sonatype internal people: + +* [@DarthHater](https://github.com/darthhater/) (Jeffry Hesse) + +External contributors: + +![Possibly You!](http://i.imgur.com/A3eScYul.jpg) diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..710eca10 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +ARG NEXUS_VERSION=3.8.0 + +FROM maven:3-jdk-8-alpine AS build +ARG NEXUS_VERSION=3.8.0 +ARG NEXUS_BUILD=02 + +COPY . /nexus-repository-composer/ +RUN cd /nexus-repository-composer/; sed -i "s/3.8.0-02/${NEXUS_VERSION}-${NEXUS_BUILD}/g" pom.xml; \ + mvn clean package; + +FROM sonatype/nexus3:$NEXUS_VERSION +ARG NEXUS_VERSION=3.8.0 +ARG NEXUS_BUILD=02 +ARG COMPOSER_VERSION=1.0.0 +ARG TARGET_DIR=/opt/sonatype/nexus/system/org/sonatype/nexus/plugins/nexus-repository-composer/${COMPOSER_VERSION}/ +USER root +RUN mkdir -p ${TARGET_DIR}; \ + sed -i 's@nexus-repository-npm@nexus-repository-npm\n nexus-repository-composer@g' /opt/sonatype/nexus/system/com/sonatype/nexus/assemblies/nexus-oss-feature/${NEXUS_VERSION}-${NEXUS_BUILD}/nexus-oss-feature-${NEXUS_VERSION}-${NEXUS_BUILD}-features.xml; \ + sed -i 's@\n
org.sonatype.nexus.plugins:nexus-repository-composer2
\n mvn:org.sonatype.nexus.plugins/nexus-repository-composer/1.0.0\n
\n +# Nexus Repository Composer Format + +[![Build Status](https://travis-ci.org/sonatype-nexus-community/nexus-repository-composer.svg?branch=master)](https://travis-ci.org/sonatype-nexus-community/nexus-repository-composer) [![Join the chat at https://gitter.im/sonatype/nexus-developers](https://badges.gitter.im/sonatype/nexus-developers.svg)](https://gitter.im/sonatype/nexus-developers?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) + +# Table Of Contents +* [Developing](#developing) + * [Requirements](#requirements) + * [Building](#building) +* [Using Composer with Nexus Repository Manger 3](#using-composer-with-nexus-repository-manager-3) +* [Installing the plugin](#installing-the-plugin) + * [Temporary Install](#temporary-install) + * [(more) Permanent Install](#more-permanent-install) + * [(most) Permament Install](#most-permanent-install) +* [The Fine Print](#the-fine-print) +* [Getting Help](#getting-help) + +## Developing + +### Requirements + +* [Apache Maven 3.3.3+](https://maven.apache.org/install.html) +* [Java 8+](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) +* Network access to https://repository.sonatype.org/content/groups/sonatype-public-grid + +Also, there is a good amount of information available at [Bundle Development](https://help.sonatype.com/display/NXRM3/Bundle+Development) + +### Building + +To build the project and generate the bundle use Maven + + mvn clean package + +If everything checks out, the bundle for Composer should be available in the `target` folder + +#### Build with Docker + +`docker build -t nexus-repository-composer:1.0.0 .` + +#### Run as a Docker container + +`docker run -d -p 8081:8081 --name nexus nexus-repository-composer:1.0.0` + +For further information like how to persist volumes check out [the GitHub repo for our official image](https://github.com/sonatype/docker-nexus3). + +The application will now be available from your browser at http://localhost:8081 + +## Using Composer With Nexus Repository Manager 3 + +[We have detailed instructions on how to get started here!](docs/COMPOSER_USER_DOCUMENTATION.md) + +## Installing the plugin + +There are a range of options for installing the Composer plugin. You'll need to build it first, and +then install the plugin with the options shown below: + +### Temporary Install + +Installations done via the Karaf console will be wiped out with every restart of Nexus Repository. This is a +good installation path if you are just testing or doing development on the plugin. + +* Enable Nexus console: edit `/bin/nexus.vmoptions` and change `karaf.startLocalConsole` to `true`. + + More details here: [Bundle Development](https://help.sonatype.com/display/NXRM3/Bundle+Development+Overview) + +* Run Nexus' console: + ``` + # sudo su - nexus + $ cd /bin + $ ./nexus run + > bundle:install file:///tmp/nexus-repository-composer-1.0.0.jar + > bundle:list + ``` + (look for org.sonatype.nexus.plugins:nexus-repository-composer ID, should be the last one) + ``` + > bundle:start + ``` + +### (more) Permanent Install + +For more permanent installs of the nexus-repository-composer plugin, follow these instructions: + +* Copy the bundle (nexus-repository-composer-1.0.0.jar) into /deploy + +This will cause the plugin to be loaded with each restart of Nexus Repository. As well, this folder is monitored +by Nexus Repository and the plugin should load within 60 seconds of being copied there if Nexus Repository +is running. You will still need to start the bundle using the karaf commands mentioned in the temporary install. + +### (most) Permanent Install + +If you are trying to use the Composer plugin permanently, it likely makes more sense to do the following: + +* Copy the bundle into `/system/org/sonatype/nexus/plugins/nexus-repository-composer/1.0.0/nexus-repository-composer-1.0.0.jar` +* Make the following additions marked with + to `/system/org/sonatype/nexus/assemblies/nexus-core-feature/3.x.y/nexus-core-feature-3.x.y-features.xml` + + ``` + nexus-repository-rubygems + + nexus-repository-composer + nexus-repository-gitlfs + + ``` + And + ``` + + + +
org.sonatype.nexus.plugins:nexus-repository-composer
+ + mvn:org.sonatype.nexus.plugins/nexus-repository-composer/1.0.0 + +
+ + ``` +This will cause the plugin to be loaded and started with each startup of Nexus Repository. + +## The Fine Print + +It is worth noting that this is **NOT SUPPORTED** by Sonatype, and is a contribution of ours +to the open source community (read: you!) + +Remember: + +* Use this contribution at the risk tolerance that you have +* Do NOT file Sonatype support tickets related to Composer support in regard to this plugin +* DO file issues here on GitHub, so that the community can pitch in + +Phew, that was easier than I thought. Last but not least of all: + +Have fun creating and using this plugin and the Nexus platform, we are glad to have you here! + +## Getting help + +Looking to contribute to our code but need some help? There's a few ways to get information: + +* Chat with us on [Gitter](https://gitter.im/sonatype/nexus-developers) +* Check out the [Nexus3](http://stackoverflow.com/questions/tagged/nexus3) tag on Stack Overflow +* Check out the [Nexus Repository User List](https://groups.google.com/a/glists.sonatype.com/forum/?hl=en#!forum/nexus-users) diff --git a/docs/COMPOSER_USER_DOCUMENTATION.md b/docs/COMPOSER_USER_DOCUMENTATION.md new file mode 100644 index 00000000..2f85885b --- /dev/null +++ b/docs/COMPOSER_USER_DOCUMENTATION.md @@ -0,0 +1,32 @@ + +## Composer Repositories + +### Introduction + +TBD + +### Proxying Composer Repositories + +TBD + +### Configuring Composer + +TBD + +### Browsing Composer Repository Packages + +You can browse Composer repositories in the user interface inspecting the components and assets and their details, as +described in [Browsing Repositories and Repository Groups](https://help.sonatype.com/display/NXRM3/Browsing+Repositories+and+Repository+Groups). diff --git a/header.txt b/header.txt new file mode 100644 index 00000000..357f804e --- /dev/null +++ b/header.txt @@ -0,0 +1,10 @@ +Sonatype Nexus (TM) Open Source Version +Copyright (c) ${project.inceptionYear}-present Sonatype, Inc. +All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions. + +This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0, +which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html. + +Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks +of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the +Eclipse Foundation. All other trademarks are the property of their respective owners. diff --git a/headers.sh b/headers.sh new file mode 100755 index 00000000..6dc98ec2 --- /dev/null +++ b/headers.sh @@ -0,0 +1,17 @@ +#!/bin/bash +dirname=`dirname $0` +dirname=`cd "$dirname" && pwd` +cd "$dirname" + +op=$1; shift +case "$op" in + 'check' | 'format') + ;; + *) + echo "usage: `basename $0` { check | format } [mvn-options]" + exit 1 +esac + +# still depends on profiles defined in https://github.com/sonatype/buildsupport/blob/master/pom.xml +mvn -f ./pom.xml -N -P license-${op} "$@" + diff --git a/pom.xml b/pom.xml new file mode 100644 index 00000000..ea9ec142 --- /dev/null +++ b/pom.xml @@ -0,0 +1,92 @@ + + + + 4.0.0 + + org.sonatype.nexus.plugins + nexus-plugins + 3.8.0-02 + + org.sonatype.nexus.plugins + nexus-repository-composer + ${project.groupId}:${project.artifactId} + 1.0.0 + 2018 + bundle + + + + + org.sonatype.nexus + nexus-plugin-api + provided + + + + org.sonatype.nexus + nexus-repository + provided + + + + org.apache.commons + commons-compress + + + + org.sonatype.goodies + goodies-testsupport + test + + + + org.sonatype.nexus + nexus-rapture + provided + + + + + + + + org.sonatype.nexus.buildsupport + extjs-maven-plugin + + NX.composer + + + + + org.sonatype.plugins + yuicompressor-maven-plugin + + + + org.apache.karaf.tooling + karaf-maven-plugin + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.20 + + + + +