|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
Publishing a second artifactI'm having difficulty publishing an artifact to my local Ivy repository
with "gradle uploadArchives". I have one project called 'ias_ta_common' that creates 2 Jars ('ias_ta_common.jar', and 'ias_ta_common_service_facade.jar') Calling "gradle uploadArchives" will upload my 'ias_ta_common.jar' as expected but I can't seem to find a way for it to publish the extra Jar. Looking at the documentation under "Artifact management" it would appear that assigning the artifact to the 'archives' configuration should be enough. Can anyone see what I'm doing wrong?. My build.gradle is as follows: --------------------------------->8---------------------------------- usePlugin 'java' srcRootName="sources" srcDirNames = ['ie'] group = 'vhi' version = '1.0' repositories{ add(new org.apache.ivy.plugins.resolver.FileSystemResolver()) { name = 'ivyLocalRepository' addIvyPattern "C:/apps/ivy-local-repository/[organisation]/[module]/[revision]/ivys/iv y.xml" addArtifactPattern "C:/apps/ivy-local-repository/[organisation]/[module]/[revision]/[ext]s/ [artifact].[ext]" descriptor = 'optional' checkmodified = true } } dependencies { compile group: 'commons-collections', name: 'commons-collections', version: '3.2' } task serviceFacade(type: Jar, dependsOn: compile){ configuration = configurations.archives ant.jar(destfile: "$buildDir/libs/ias_ta_common_service_facade-${version}.jar") { fileset(dir: "$classesDir") { include(name: "ie/vhi/ias/ta/common/services/facade/**") } } } artifacts { archives serviceFacade } uploadArchives { uploadDescriptor = true repositories{ add project.repositories.ivyLocalRepository } } --------------------------------->8---------------------------------- Thanks for your help, Donal. --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: Publishing a second artifactOn Jun 16, 2009, at 11:40 AM, Donal Mc Namee wrote: > I'm having difficulty publishing an artifact to my local Ivy > repository > with "gradle uploadArchives". > > I have one project called 'ias_ta_common' that creates 2 Jars > ('ias_ta_common.jar', and 'ias_ta_common_service_facade.jar') > > Calling "gradle uploadArchives" will upload my 'ias_ta_common.jar' as > expected but I can't seem to find a way for it to publish the extra > Jar. > > > Looking at the documentation under "Artifact management" it would > appear > that assigning the artifact to the 'archives' configuration should be > enough. > > Can anyone see what I'm doing wrong?. My build.gradle is as follows: > > --------------------------------->8---------------------------------- > usePlugin 'java' > > srcRootName="sources" > srcDirNames = ['ie'] > > group = 'vhi' > version = '1.0' > > repositories{ > add(new org.apache.ivy.plugins.resolver.FileSystemResolver()) { > name = 'ivyLocalRepository' > addIvyPattern > "C:/apps/ivy-local-repository/[organisation]/[module]/[revision]/ > ivys/iv > y.xml" > addArtifactPattern > "C:/apps/ivy-local-repository/[organisation]/[module]/[revision]/ > [ext]s/ > [artifact].[ext]" > descriptor = 'optional' > checkmodified = true > } > } > > dependencies { > compile group: 'commons-collections', name: 'commons-collections', > version: '3.2' > } > > task serviceFacade(type: Jar, dependsOn: compile){ > configuration = configurations.archives > ant.jar(destfile: > "$buildDir/libs/ias_ta_common_service_facade-${version}.jar") { > fileset(dir: "$classesDir") { > include(name: "ie/vhi/ias/ta/common/services/facade/**") > } > } > } The problem lies here. You are creating an archive with Ant in the configuration closure of a Jar task. In fact this archive won't contain anything. At least not after a clean. As this is executed before any Gradle task is executed. And you don't configure the actual serviceFacade task to produce the archive. Instead you can do: task serviceFacade(type: Jar, dependsOn: compile) { baseName = 'ias_ta_common_service_facade' fileSet(dir: classesDir) { include("ie/vhi/ias/ta/common/services/facade/**") } } I haven't tried it out but it should work. See also section 15.12 of the UG: http://gradle.org/0.6.1/docs/userguide/java_plugin.html#N112D5 > > artifacts { > archives serviceFacade > } > > uploadArchives { > uploadDescriptor = true > repositories{ > add project.repositories.ivyLocalRepository > } > } - Hans -- Hans Dockter Gradle Project Manager http://www.gradle.org --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
RE: Publishing a second artifactHi Hans,
Thanks for that solution. It works fine and publishes both artifacts. However, it appears that the new Jar task is including all the classes found in 'classesDir' as well as 'servicesFacadeClassesDir' (See task below:) task jarServiceFacade(type: Jar, dependsOn: compileServiceFacade) { baseName = 'ias_ta_common_service_facade' fileSet(dir: servicesFacadeClassesDir) { include("ie/vhi/ias/ta/common/services/facade/**") } } When I run gradle with the -d flag it reports: - Creating archive: jarServiceFacade - fileset: Setup scanner in dir C:\workspace\Core\branches\TEMP_gradle\TA\ias_ta_common\build\classes with patternSet{ includes: [] excludes: [] } - fileset: Setup scanner in dir C:\workspace\Core\branches\TEMP_gradle\TA\ias_ta_common\build\facade-cla sses with patternSet{ includes: [ie/vhi/ias/ta/common/services/facade/**] excludes: [] } So it looks like the task 'jarServiceFacade' is inheriting something that causes it to include classes found in 'classesDir'. Have you any ideas as to why that may be? Thanks, Donal. >-----Original Message----- >From: Hans Dockter [mailto:mail@...] >Sent: 16 June 2009 21:38 >To: user@... >Subject: Re: [gradle-user] Publishing a second artifact > > >On Jun 16, 2009, at 11:40 AM, Donal Mc Namee wrote: > >> I'm having difficulty publishing an artifact to my local Ivy >> repository with "gradle uploadArchives". >> >> I have one project called 'ias_ta_common' that creates 2 Jars >> ('ias_ta_common.jar', and 'ias_ta_common_service_facade.jar') >> >> Calling "gradle uploadArchives" will upload my >'ias_ta_common.jar' as >> expected but I can't seem to find a way for it to publish the extra >> Jar. >> >> >> Looking at the documentation under "Artifact management" it would >> appear that assigning the artifact to the 'archives' configuration >> should be enough. >> >> Can anyone see what I'm doing wrong?. My build.gradle is as follows: >> >> --------------------------------->8---------------------------------- >> usePlugin 'java' >> >> srcRootName="sources" >> srcDirNames = ['ie'] >> >> group = 'vhi' >> version = '1.0' >> >> repositories{ >> add(new org.apache.ivy.plugins.resolver.FileSystemResolver()) { >> name = 'ivyLocalRepository' >> addIvyPattern >> "C:/apps/ivy-local-repository/[organisation]/[module]/[revision]/ >> ivys/iv >> y.xml" >> addArtifactPattern >> "C:/apps/ivy-local-repository/[organisation]/[module]/[revision]/ >> [ext]s/ >> [artifact].[ext]" >> descriptor = 'optional' >> checkmodified = true >> } >> } >> >> dependencies { >> compile group: 'commons-collections', name: 'commons-collections', >> version: '3.2' >> } >> >> task serviceFacade(type: Jar, dependsOn: compile){ configuration = >> configurations.archives >> ant.jar(destfile: >> "$buildDir/libs/ias_ta_common_service_facade-${version}.jar") { >> fileset(dir: "$classesDir") { >> include(name: "ie/vhi/ias/ta/common/services/facade/**") >> } >> } >> } > >The problem lies here. You are creating an archive with Ant in >the configuration closure of a Jar task. In fact this archive >won't contain anything. At least not after a clean. As this is >executed before any Gradle task is executed. And you don't >configure the actual serviceFacade task to produce the >archive. Instead you can do: > >task serviceFacade(type: Jar, dependsOn: compile) { > baseName = 'ias_ta_common_service_facade' > fileSet(dir: classesDir) { > include("ie/vhi/ias/ta/common/services/facade/**") > } >} > >I haven't tried it out but it should work. > >See also section 15.12 of the UG: >http://gradle.org/0.6.1/docs/userguide/java_plugin.html#N112D5 > >> >> artifacts { >> archives serviceFacade >> } >> >> uploadArchives { >> uploadDescriptor = true >> repositories{ >> add project.repositories.ivyLocalRepository >> } >> } > >- Hans > >-- >Hans Dockter >Gradle Project Manager >http://www.gradle.org > > >--------------------------------------------------------------------- >To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: Publishing a second artifactOn Jun 17, 2009, at 4:54 PM, Donal Mc Namee wrote: > Hi Hans, > Thanks for that solution. It works fine and publishes both artifacts. > > However, it appears that the new Jar task is including all the classes > found in 'classesDir' as well as 'servicesFacadeClassesDir' (See task > below:) > > task jarServiceFacade(type: Jar, dependsOn: compileServiceFacade) { > baseName = 'ias_ta_common_service_facade' > fileSet(dir: servicesFacadeClassesDir) { > include("ie/vhi/ias/ta/common/services/facade/**") > } > } > > When I run gradle with the -d flag it reports: > > - Creating archive: jarServiceFacade > - fileset: Setup scanner in dir > C:\workspace\Core\branches\TEMP_gradle\TA\ias_ta_common\build\classes > with patternSet{ includes: [] excludes: [] } > - fileset: Setup scanner in dir > C:\workspace\Core\branches\TEMP_gradle\TA\ias_ta_common\build\facade- > cla > sses with patternSet{ includes: > [ie/vhi/ias/ta/common/services/facade/**] excludes: [] } > > So it looks like the task 'jarServiceFacade' is inheriting something > that causes it to include classes found in 'classesDir'. > > Have you any ideas as to why that may be? This is a bug. Could you file a Jira with fix for 0.7? Meanwhile you can use this hack as a work around: task jarServiceFacade(type: Jar, dependsOn: compileServiceFacade) { resourceCollections = [] // If this is null, the default value classesDir is used. baseName = 'ias_ta_common_service_facade' fileSet(dir: servicesFacadeClassesDir) { include("ie/vhi/ias/ta/common/services/facade/**") } } - Hans -- Hans Dockter Gradle Project Manager http://www.gradle.org --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
| Free embeddable forum powered by Nabble | Forum Help |