Thanks all for suggestions! 
For now, I just added another option to “JavaNatureConfiguration” and some 
logic into “pom.withXml" function.

I created a PR about that:
https://github.com/apache/beam/pull/10832 
<https://github.com/apache/beam/pull/10832>

> On 7 Feb 2020, at 01:06, Luke Cwik <lc...@google.com> wrote:
> 
> It could do that as well.
> 
> On Thu, Feb 6, 2020 at 11:25 AM Kenneth Knowles <k...@apache.org 
> <mailto:k...@apache.org>> wrote:
> That XML-generating code should be able to traverse project.repositories and 
> add them on a per-module basis, no?
> 
> On Thu, Feb 6, 2020 at 9:47 AM Luke Cwik <lc...@google.com 
> <mailto:lc...@google.com>> wrote:
> We generate the pom using Gradle here[1].
> 
> The issue is that it applies to all beam modules and what you are asking for 
> isn't currently plumbed through. You could try adding an option to the 
> JavaNatureConfiguration[2] and then specify the additional repository in your 
> module.
> 
> 1: 
> https://github.com/apache/beam/blob/2473792306879e3fa6c5ab1f95523c7b44b4e288/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy#L1142
>  
> <https://github.com/apache/beam/blob/2473792306879e3fa6c5ab1f95523c7b44b4e288/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy#L1142>
> 2: 
> https://github.com/apache/beam/blob/2473792306879e3fa6c5ab1f95523c7b44b4e288/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy#L81
>  
> <https://github.com/apache/beam/blob/2473792306879e3fa6c5ab1f95523c7b44b4e288/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy#L81>
> On Thu, Feb 6, 2020 at 9:38 AM Jean-Baptiste Onofre <j...@nanthrax.net 
> <mailto:j...@nanthrax.net>> wrote:
> Like this:
> repositories {
>   jcenter()
>   maven { url "https://plugins.gradle.org/m2/ 
> <https://plugins.gradle.org/m2/>" }
>   maven {
>     url "https://repo.spring.io/plugins-release/ 
> <https://repo.spring.io/plugins-release/>"
>     content { includeGroup "io.spring.gradle" }
>   }
>   maven { url "foo" }
> }
> 
> 
>> Le 6 févr. 2020 à 18:37, Jean-Baptiste Onofre <j...@nanthrax.net 
>> <mailto:j...@nanthrax.net>> a écrit :
>> 
>> Great, thanks !
>> 
>> Back on your question, I guess we can add the repository in 
>> buildSrc/build.gradle (repositories property).
>> 
>> Regards
>> JB
>> 
>>> Le 6 févr. 2020 à 18:33, Alexey Romanenko <aromanenko....@gmail.com 
>>> <mailto:aromanenko....@gmail.com>> a écrit :
>>> 
>>> Yes, it's Apache License 2.0
>>> 
>>> https://packages.confluent.io/maven/io/confluent/kafka-avro-serializer/5.4.0/kafka-avro-serializer-5.4.0.pom
>>>  
>>> <https://packages.confluent.io/maven/io/confluent/kafka-avro-serializer/5.4.0/kafka-avro-serializer-5.4.0.pom>
>>> 
>>>> On 6 Feb 2020, at 18:12, Jean-Baptiste Onofre <j...@nanthrax.net 
>>>> <mailto:j...@nanthrax.net>> wrote:
>>>> 
>>>> Hi,
>>>> 
>>>> Just a side note: did you check the license of the dependency (just to be 
>>>> sure it’s not a Cat X dependency) ?
>>>> 
>>>> Regards
>>>> JB
>>>> 
>>>>> Le 6 févr. 2020 à 18:06, Alexey Romanenko <aromanenko....@gmail.com 
>>>>> <mailto:aromanenko....@gmail.com>> a écrit :
>>>>> 
>>>>> Hi,
>>>>> 
>>>>> To add support of Confluent Registry Schema in KafkaIO we added new 
>>>>> dependency on “io.confluent:kafka-avro-serializer”. The artifacts of this 
>>>>> dependency exist in external repository [1]. So, it should not be a 
>>>>> problem to add this repository into the list of available repositories of 
>>>>> Beam build system - it works fine to build Beam KafkaIO artifacts. 
>>>>> 
>>>>> The actual problem is with transitive dependency of 
>>>>> “io.confluent:kafka-avro-serializer” in user code. We add this dependency 
>>>>> into generated and then published KafkaIO's pom.xml but, to successfully 
>>>>> resolve it, we need to add a new repository [1] as well (or user should 
>>>>> add that manually in its pom which is definitevly not a perfect solution).
>>>>> 
>>>>> So, my questions to grade/build experts:
>>>>> 
>>>>> 1) How to add more repositories into published pom.xml with gradle, like 
>>>>> we do it in maven?
>>>>> 
>>>>> For example:
>>>>> <repositories>
>>>>>     <repository>
>>>>>         <id>confluent</id>
>>>>>         <url>https://packages.confluent.io/maven/ 
>>>>> <https://packages.confluent.io/maven/></url>
>>>>>     </repository>
>>>>> </repositories>
>>>>> 
>>>>> I tried several ways to do that, like adding "repositories { maven { url 
>>>>> "https://packages.confluent.io/maven 
>>>>> <https://packages.confluent.io/maven>/“ } }” into KafkaIO build.gradle 
>>>>> but seems it doesn’t work (I don’t see any additional repositories in 
>>>>> published pom file). 
>>>>> 
>>>>> 2) Another option - would it better to vendor 
>>>>> “io.confluent:kafka-avro-serializer” along with KafkaIO and do not add an 
>>>>> addition dependency? Wdyt?
>>>>> 
>>>>> 3) Any other recommendations of better solution for such case?
>>>>> 
>>>>> Any help on this topic will be very appreciated.
>>>>> 
>>>>> Alexey
>>>>> 
>>>>> [1] https://packages.confluent.io/maven/ 
>>>>> <https://packages.confluent.io/maven/>
>>> 
>> 
> 

Reply via email to