A project I'm working on uses Gradle to build code bases. I'm quite new to Gradle. I want to modify the current build process such that, once the build concludes, it moves a set of files (configuration files in this case), which are under source control (SVN), to a folder on another server on the network.
I've looked through the Gradle user guide, and have come across the 'copy' and 'sync' tasks. Will either of these be sufficient to carry out what I've described? Thanks for your help.
You can define a remote repository and upload there like in How to upload artifact to network drive using gradle?
If that doesn't suit your need you can look for gradle-ssh-plugin or just write a task that will execute scp or something similar.
Related
I want to set up a small cucumber (maven) project in Jenkins in my company. The source code is local on my machine and not on any subversion system. I have already created a new job in jenkins. While configuring I am asked to give path to my pom.xml. But I dont know how do I give path.
Also I triggered Jenkins build without even configuring it properly, and therefore it has generated Workspace (Arbeitsbereich in german) for me. Now I think I just need to copy my source code to the created Workspace, but I dont know how do I do that exactly.
May be I am doing something really dumb here :( could someone please help ?
Jenkins default directory would be '~/.jenkins' where your jobs should be located. you can follow this link to use a custom directory as your work space.
After that, you can specify the path of your application pom.xml file relatively to your custom workspace location.
I have a project that involves moving files from one directory to another repeatedly during build and debugging processes. To help with that, I ended up making a task to file copy parts of the project from one location to another.
Is there a way to get gradle to perform an rsync instead of a copy? I feel like 2 minutes to copy all of the necessary files when only making a few changes to one isn't exactly efficient.
Or is there something wrong with gradle for it to be taking that long?
Gradle doesn't ship with rsync-like functionality, but you could call rsync using an Exec task. It's also worthwhile to check whether there is a third-party plugin.
I'm using Jenkins integrated with git and gerrit trigger.
I manage a huge repo that leads with a big amount of commits. So i'm not interested on running a complete build of the whole project on every push.
The idea here is just build the especific project .pom file where there is code changes.
For example:
-"common" is a subdir with its own .pom
-"persistence" is a subdir with its own .pom. "persistence" depends on common dir.
So if there is a change on persistence dir i have to build only the persistence .pom file because it will build common as a dependencie. On the other hand if someone change code on common, the jenkins do not have the necessity of building persistence. So it will save me time and hw resources.
So the question here is how could i do this? Does gerrit trigger have any support for this?
Update: On selecting the changed files does the file RegEx option refers to the file Path or the file name?
And also, is there a way to, using file RegEx field, express something like build "if changes in common and not changes in persistence"?
Have you tried to use Dynamic Trigger Configuration? you define a filter - on which change the job should start. So you create jobs for each build then define a proper gerrit trigger with filter.
Or if you want to use only 1 job for every build - then write a script where you can use git to determine which file was changed and then select the right project file for it.
Update: try to play with New build parameter: GERRIT_TOPIC
So push your changes with a proper TOPIC name e.g.
git push origin HEAD:refs/for/master/topic_name
where topic_name can be common, persistence
the topic name can be filled automatically with pre-push hook in git.
I'm in the process of updating our build process for Android to use gradle. We have client-specific apps - i.e. a single code template which is used as the basis for all the apps which are created dynamically.
To build the apps, I loop through a CSV file to get the details for each one. I then take a copy of the source template, inserting the client's name, images, etc. before compiling the app. This works fine in the current system. In the gradle version, I've got it successfully looping through the rows and creating the app source for each one with the right details. However when I try to actually build the app, it fails with the message:
Project with path ':xxxxxx' could not be found in root project 'android-gradle'.
From reading the documentation, I understand that this is because the project doesn't exist during the configuration phase as it's not created until the execution phase. However what I haven't been able to find is a way around this. Has anyone managed to achieve something similar? Or perhaps a suggestion for a better approach?
One option is to script settings.gradle. As in any other Gradle script, you have the full power of Groovy available. Later on you can no longer change which projects the build is composed of. Note that settings.gradle will be evaluated for each and every invocation of Gradle, so evaluation needs to be fast.
While Peter's answer pointed me in the right direction, it ended up not being a workable solution. Unfortunately with nearly 200 apps to build, creating a copy of the source for each one was too big an overhead and gradle kept running out of memory.
What I have done instead is to make use of the Android plugin's product flavors functionality. It was quite straight forward dynamically adding a productFlavor for each row in the CSV (and I can do that in build.gradle rather than settings.gradle), and I just set the srcDir to point to the relevant images etc for each one.
I want to deploy a generated Maven AppAssembler assembler/ directory to somewhere in a file system, SSH, or whatnot. Can Cargo do that for me, or is there an equivalent deployment tool that will let me glob a bunch of files (in this case the target/appassembler/ directory) and deploy them to a destination?
I have a couple command-line applications that run as scheduled tasks (via cron or Windows Scheduler), and I want to deploy them out to these remote locations (in one case via SSH, and another a network share \\servername\C$\whatever\). I don't know how I can accomplish that, since all of the deployment plugins I have been looking at cater to web applications and app containers or Remote repos like Nexus.
Try maven copy plugin - it has excellent networking support (scp,FTP,HTTP).
You might also find useful maven sshexec plugin.
I know this question is quite old, but since someone else might also be interested in this:
I don't have a complete/concrete example for this, since I never tried it, but maybe the maven assembly plugin could be used for this, with the dir assembly format?