Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build improvements #202

Merged
merged 4 commits into from
Jun 3, 2018
Merged

Build improvements #202

merged 4 commits into from
Jun 3, 2018

Conversation

jmini
Copy link
Member

@jmini jmini commented Jun 2, 2018

  • Docs: set version to 3.0.0 in the Readme of openapi-generator-maven-plugin
  • Changes "openapi-generator-gradle-plugin"
    • Change artifactId to avoid confusion between the real gradle plugin and the maven wrapper that calls gradle.
    • Disable maven-install-plugin for the wrapper
    • Disable maven-deploy-plugin for the wrapper

@jmini jmini changed the title Build fixes WIP - Build fixes Jun 2, 2018
@jmini
Copy link
Member Author

jmini commented Jun 2, 2018

I have noticed that we have also the "wrong pom and wrong jar for openapi-generator-gradle-plugin" problem on our snapshot repository (https://oss.sonatype.org/content/repositories/snapshots/) and I have tried to address this the maven way.


This is what I have tried with commit 4106857:

After the run of gradle-maven-plugin I have added two steps:

First step:
Copy the artifact from the maven local repository into an other one target/gradle-artifacts like this:

<!-- 3) copy the gradle artifacts to '/target/gradle-artifacts'. -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>copy-gradle-artifacts</id>
<phase>install</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.basedir}/target/gradle-artifacts</outputDirectory>
<resources>
<resource>
<directory>${settings.localRepository}/org/openapitools/openapi-generator-gradle-plugin/${project.version}/</directory>
<filtering>false</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>

This is requested for the next step. deploy-file request the file to be outside of the maven local repository. Otherwise this error is displayed:

Cannot deploy artifact from the local repository

Next step:
I have used the deploy-file goal of the maven-deploy-plugin to upload the artifacts generated by gradle:

<!-- deploy the jar and the pom from the local maven repo (the one created by gradle) -->
<execution>
<id>custom-deploy</id>
<phase>deploy</phase>
<goals>
<goal>deploy-file</goal>
</goals>
<configuration>
<id>sonatype-nexus-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<file>${project.basedir}/target/gradle-artifacts/openapi-generator-gradle-plugin-${project.version}.jar</file>
<pomFile>${project.basedir}/target/gradle-artifacts/openapi-generator-gradle-plugin-${project.version}.pom</pomFile>
</configuration>
</execution>

I see two problems with this approach:

  • First we need to configure one distant maven repository. I have configured sonatype-nexus-snapshots but this means that this config is not valid when we deploy a release. The normal deploy mojo seems to work with the <distributionManagement> section (defined in the effective pom). This seems to support the fact that the release repo and the snapshot repos are not the same.
  • Second issue: the credentials are missing. I am not sure how this is solved.

Log from the travis build:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy-file (custom-deploy) on project openapi-generator-gradle-plugin-mvn-wrapper: Failed to deploy artifacts: Could not transfer artifact org.openapitools:openapi-generator-gradle-plugin:jar:3.0.1-20180602.132316-5 from/to remote-repository (https://oss.sonatype.org/content/repositories/snapshots/): Failed to transfer file: https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-gradle-plugin/3.0.1-SNAPSHOT/openapi-generator-gradle-plugin-3.0.1-20180602.132316-5.jar. Return code is: 401, ReasonPhrase: Unauthorized. -> [Help 1]

I will revert the two steps described here in order to have a PR that can be merged. We need to continue to investigate how we can upload the graddle jars to the distant maven repository. We can use either maven or gradle. We need something that works for release and for snapshots. Related PR #201.

cc @jimschubert

@jmini jmini changed the title WIP - Build fixes Build improvements Jun 2, 2018
@jmini
Copy link
Member Author

jmini commented Jun 2, 2018

In my opinion this is ready to be merged. CI is ok (CircleCI is unrelated to this change), description was edited to represent the content of this PR.

This is an improvement in regard to what we have now.
The deploy part (discussed in the middle of this PR) can be fixed in a follow-up PR or as part of #201.

@jimschubert
Copy link
Member

@jmini to release the gradle plugin, we'll need to make sure we have the configuration values mentioned in #201 in place and then we just need to call ./gradlew uploadArchives at the end of the CI script. The build.gradle handles everything for snapshot vs release maintenance (including signing of all artifacts and pom and publishing of jar/sources/javadoc artifacts). The only things we really need hooked into the maven lifecycle are clean and build/test.

@jimschubert jimschubert merged commit df55ab3 into master Jun 3, 2018
@jimschubert jimschubert deleted the build-fixes branch June 3, 2018 01:06
@wing328 wing328 added this to the 3.0.1 milestone Jun 3, 2018
jimschubert added a commit to jimschubert/openapi-generator that referenced this pull request Jun 4, 2018
* master:
  Fix javadoc in clioption (OpenAPITools#188)
  Build improvements (OpenAPITools#202)
  Prepare 3.0.1-SNAPSHOT (OpenAPITools#195)
@jmini jmini mentioned this pull request Jun 5, 2018
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants