You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@beam.apache.org by Nithin Sujir <ns...@google.com> on 2018/09/25 17:19:23 UTC

Installing jars to local maven repo

Hi Beam devs,
We have a couple of maven projects (teleport and performance test utilties)
that depend on beam. We are also working to improve the spanner io
connector performance in beam. Today, it's quite painful to make local beam
changes and then use it in our performance tests due to the maven project
expecting the jars to be in the .m2 directory hierarchy.

I discovered there is a plugin 'maven-publish' which solves this problem.
https://docs.gradle.org/current/userguide/publishing_maven.html

It requires applying this plugin to the top level build.gradle file as in
the diff below. It provides a PublishToMavenLocal task that copies the jars
to the .m2/... dir.

diff --git a/build.gradle b/build.gradle
index ba30ee92c9..faf35e5f69 100644
--- a/build.gradle
+++ b/build.gradle
@@ -254,3 +254,5 @@ release {
     requireBranch = 'release-.*|master'
   }
 }
+
+apply plugin: 'maven-publish'

Is this acceptable? If so, I would be happy to submit a patch.

Thanks,
Nithin.

Re: Installing jars to local maven repo

Posted by Nithin Sujir <ns...@google.com>.
After reading the code,

      if ((isRelease(project) || project.hasProperty('publishing')) &&
      configuration.publish) {
        project.apply plugin: "maven-publish"

 I realized that it's including the same plugin conditionally and I just
needed to set the flag to what I was doing earlier. The following command
worked for me.
         ./gradlew -Ppublishing PublishToMavenLocal

Thank you for pointing me in the right direction!

Nithin.



On Tue, Sep 25, 2018 at 11:33 AM Nithin Sujir <ns...@google.com> wrote:

> Thanks for the info about publish. It is installing the jars, however I am
> hitting issue with the name.
>
> Every time I publish, it increments the version number which I think is
> preventing my maven project from discovering the jars. I would like the jar
> file to be xxxx-2.8.0-SNAPSHOT.jar for e.g.
>
> The command I'm using is:
> ./gradlew publish -Ppublishing
> -PdistMgmtSnapshotsUrl=file:///usr/local/google/home/nsujir/.m2/repository/
>
> Am I doing something wrong?
>
> Thanks,
> Nithin.
>
>
>
>
> On Tue, Sep 25, 2018 at 10:39 AM Thomas Weise <th...@apache.org> wrote:
>
>> Publish to a custom repo is already supported. Please see:
>> https://lists.apache.org/thread.html/fdc82e7399fa63f3ffe21458830cd05c84c08c61d44ff94859618d31@%3Cdev.beam.apache.org%3E
>>
>>
>> On Tue, Sep 25, 2018 at 10:21 AM Jean-Baptiste Onofré <jb...@nanthrax.net>
>> wrote:
>>
>>> Hi
>>>
>>> We already have publish profile in our Gradle build. Did you try with
>>> this ?
>>>
>>> Regards
>>> JB
>>> Le 25 sept. 2018, à 13:19, Nithin Sujir <ns...@google.com> a écrit:
>>>>
>>>> Hi Beam devs,
>>>> We have a couple of maven projects (teleport and performance test
>>>> utilties) that depend on beam. We are also working to improve the spanner
>>>> io connector performance in beam. Today, it's quite painful to make local
>>>> beam changes and then use it in our performance tests due to the maven
>>>> project expecting the jars to be in the .m2 directory hierarchy.
>>>>
>>>> I discovered there is a plugin 'maven-publish' which solves
>>>> this problem.
>>>> https://docs.gradle.org/current/userguide/publishing_maven.html
>>>>
>>>> It requires applying this plugin to the top level build.gradle file as
>>>> in the diff below. It provides a PublishToMavenLocal task that copies the
>>>> jars to the .m2/... dir.
>>>>
>>>> diff --git a/build.gradle b/build.gradle
>>>> index ba30ee92c9..faf35e5f69 100644
>>>> --- a/build.gradle
>>>> +++ b/build.gradle
>>>> @@ -254,3 +254,5 @@ release {
>>>>      requireBranch = 'release-.*|master'
>>>>    }
>>>>  }
>>>> +
>>>> +apply plugin: 'maven-publish'
>>>>
>>>> Is this acceptable? If so, I would be happy to submit a patch.
>>>>
>>>> Thanks,
>>>> Nithin.
>>>>
>>>>

Re: Installing jars to local maven repo

Posted by Nithin Sujir <ns...@google.com>.
Thanks for the info about publish. It is installing the jars, however I am
hitting issue with the name.

Every time I publish, it increments the version number which I think is
preventing my maven project from discovering the jars. I would like the jar
file to be xxxx-2.8.0-SNAPSHOT.jar for e.g.

The command I'm using is:
./gradlew publish -Ppublishing
-PdistMgmtSnapshotsUrl=file:///usr/local/google/home/nsujir/.m2/repository/

Am I doing something wrong?

Thanks,
Nithin.




On Tue, Sep 25, 2018 at 10:39 AM Thomas Weise <th...@apache.org> wrote:

> Publish to a custom repo is already supported. Please see:
> https://lists.apache.org/thread.html/fdc82e7399fa63f3ffe21458830cd05c84c08c61d44ff94859618d31@%3Cdev.beam.apache.org%3E
>
>
> On Tue, Sep 25, 2018 at 10:21 AM Jean-Baptiste Onofré <jb...@nanthrax.net>
> wrote:
>
>> Hi
>>
>> We already have publish profile in our Gradle build. Did you try with
>> this ?
>>
>> Regards
>> JB
>> Le 25 sept. 2018, à 13:19, Nithin Sujir <ns...@google.com> a écrit:
>>>
>>> Hi Beam devs,
>>> We have a couple of maven projects (teleport and performance test
>>> utilties) that depend on beam. We are also working to improve the spanner
>>> io connector performance in beam. Today, it's quite painful to make local
>>> beam changes and then use it in our performance tests due to the maven
>>> project expecting the jars to be in the .m2 directory hierarchy.
>>>
>>> I discovered there is a plugin 'maven-publish' which solves this problem.
>>> https://docs.gradle.org/current/userguide/publishing_maven.html
>>>
>>> It requires applying this plugin to the top level build.gradle file as
>>> in the diff below. It provides a PublishToMavenLocal task that copies the
>>> jars to the .m2/... dir.
>>>
>>> diff --git a/build.gradle b/build.gradle
>>> index ba30ee92c9..faf35e5f69 100644
>>> --- a/build.gradle
>>> +++ b/build.gradle
>>> @@ -254,3 +254,5 @@ release {
>>>      requireBranch = 'release-.*|master'
>>>    }
>>>  }
>>> +
>>> +apply plugin: 'maven-publish'
>>>
>>> Is this acceptable? If so, I would be happy to submit a patch.
>>>
>>> Thanks,
>>> Nithin.
>>>
>>>

Re: Installing jars to local maven repo

Posted by Thomas Weise <th...@apache.org>.
Publish to a custom repo is already supported. Please see:
https://lists.apache.org/thread.html/fdc82e7399fa63f3ffe21458830cd05c84c08c61d44ff94859618d31@%3Cdev.beam.apache.org%3E


On Tue, Sep 25, 2018 at 10:21 AM Jean-Baptiste Onofré <jb...@nanthrax.net>
wrote:

> Hi
>
> We already have publish profile in our Gradle build. Did you try with this
> ?
>
> Regards
> JB
> Le 25 sept. 2018, à 13:19, Nithin Sujir <ns...@google.com> a écrit:
>>
>> Hi Beam devs,
>> We have a couple of maven projects (teleport and performance test
>> utilties) that depend on beam. We are also working to improve the spanner
>> io connector performance in beam. Today, it's quite painful to make local
>> beam changes and then use it in our performance tests due to the maven
>> project expecting the jars to be in the .m2 directory hierarchy.
>>
>> I discovered there is a plugin 'maven-publish' which solves this problem.
>> https://docs.gradle.org/current/userguide/publishing_maven.html
>>
>> It requires applying this plugin to the top level build.gradle file as in
>> the diff below. It provides a PublishToMavenLocal task that copies the jars
>> to the .m2/... dir.
>>
>> diff --git a/build.gradle b/build.gradle
>> index ba30ee92c9..faf35e5f69 100644
>> --- a/build.gradle
>> +++ b/build.gradle
>> @@ -254,3 +254,5 @@ release {
>>      requireBranch = 'release-.*|master'
>>    }
>>  }
>> +
>> +apply plugin: 'maven-publish'
>>
>> Is this acceptable? If so, I would be happy to submit a patch.
>>
>> Thanks,
>> Nithin.
>>
>>

Re: Installing jars to local maven repo

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi

We already have publish profile in our Gradle build. Did you try with this ?

Regards
JB

Le 25 sept. 2018 à 13:19, à 13:19, Nithin Sujir <ns...@google.com> a écrit:
>Hi Beam devs,
>We have a couple of maven projects (teleport and performance test
>utilties)
>that depend on beam. We are also working to improve the spanner io
>connector performance in beam. Today, it's quite painful to make local
>beam
>changes and then use it in our performance tests due to the maven
>project
>expecting the jars to be in the .m2 directory hierarchy.
>
>I discovered there is a plugin 'maven-publish' which solves this
>problem.
>https://docs.gradle.org/current/userguide/publishing_maven.html
>
>It requires applying this plugin to the top level build.gradle file as
>in
>the diff below. It provides a PublishToMavenLocal task that copies the
>jars
>to the .m2/... dir.
>
>diff --git a/build.gradle b/build.gradle
>index ba30ee92c9..faf35e5f69 100644
>--- a/build.gradle
>+++ b/build.gradle
>@@ -254,3 +254,5 @@ release {
>     requireBranch = 'release-.*|master'
>   }
> }
>+
>+apply plugin: 'maven-publish'
>
>Is this acceptable? If so, I would be happy to submit a patch.
>
>Thanks,
>Nithin.