How to configure using specific directories for TeamCity VCS - version-control

In TeamCity I have Version Control settings connected to a git repo, however that repo contains two directories that each have build.xml files (for ant) I wish to only execute tests in one folder. Unsure how to specify a specific directory in my TeamCity project, as it's not finding build.xml in the root directory.

Go to Edit Configuration Settings
Then Build Steps -> Create if needed
Edit Build Step -> Set Working Directory as directory in repo
Run the project build and it should point to specific directory

Related

Egit: How to create a git repository that is in a separate folder from the project workspace in Eclipse?

In Eclipse Oxygen, I created a project called testproj at c:\jwork2019\testproj\. My workspace is at c:\jwork2019\. The project's folder has the content of
c:\jwork2019\testproj\.settings\
c:\jwork2019\testproj\src\
c:\jwork2019\testproj\.project
I would like to create a git repo for the project, located at a separate repo directory at c:\jrepo2019\. I successfully created the empty repo c:\jrepo2019\testproj\.git\. I want it to track all the project's files located at the workspace at c:\jwork2019\testproj\*.
I have successfully created the project and the empty repo via Eclipse and Egit.
The problem is when I tried to Configure Git Repository of the project by right-clicking on the project and then Team -> Share Project..., I could select the repository created, but it changes/moves the project's folder location from my workspace at c:\jwork2019\testproj\ to c:\jrepo2019\testproj\testproj\.
I would like the project workspace directory stays in c:\jwork2019 instead of moving the project directory to the repository folder c:\jrepo2019\....
I am guessing that I can do that via git command line by just git add c:\jworks2019\testproj\*, but I don't think I have the git command line installed, I only have git on Eclipse.
I found the question Can I store the .git folder outside the files I want tracked? that has the same goal. But it does it on linux command line.
Is this achievable in eclipse? And how can I do what I wanna do? Thanks

How to create a Unix shell script project in NetBeans?

I want to clone my Git repo into NetBeans (which only contains a Unix shell script).
When I'm asked by NetBeans if I would like to create a project for this repo, I only find Java, PHP, Web, C/C++, etc.. projects groups, but I want an bare-bone group, it's just a shell script file, what to do?
I don't want Ant or building anything, I just want to use NetBeans as an editor and commit changes to Git.
Ok, here goes, after cloning the project from GitHub, I was asked by NetBeans if would like to create a project, so I chose yes, then:
1) I chose "Java" under Categories and "Java Free-Form Project" under Projects
2) I created an Ant build file "build.xml" from sample on https://ant.apache.org/manual/using.html
3) After creating the project I moved the "build.xml" to directory "nbproject" and updated "nbproject/project.xml" to point to the new build file destination
4) I updated the "build.xml" tasks to copy source files and license file in case of build and zip the build files in case of distribution
5) Finally I had to add a ".gitignore" fie to the root directory to ignore the "build" and "dist" directories from Git
After this I commited and pushed the whole NB project to GitHub you can find the final files here https://github.com/asaeles/sql_runner
for such simple projects, netbeans would be kind of an overkill, I believe notepad++ and normal git shell would suffice

Can a folder that is in a Git repo be imported into Eclipse if it is not part of a project?

There is a folder in a Git repo which holds a bunch of sql scripts but the folder is not part of any project. When I try to create a folder in Eclipse it seems to require that I specify an existing project for it to be a subfolder of. Is that always required or can a folder exist at the same level as the projects, with no project for it to be under?
Everything in an Eclipse workspace must be in a project. Folders cannot be at the same level as a project.

Jenkins sbt plugin config for build in subdirectory

I want to build a scala application via the jenkins sbt plugin.
The build.sbt file of my project does not reside in the root directory of the git repository, but in a subdirectory called 'webapp'.
How do i tell sbt within my Jenkins Job that it should do the building in that very subdirectory and not in the workspace root?
If you're using the "Build using sbt" build step, then under the "Actions" field you will find an Advanced… button.
Clicking that will reveal a "Sub-directory Path" configuration option, where you can enter webapp.

Jenkins: How do I check out two repository URLs into the same workspace without deleting the first one?

our project structure has been split. On the one hand there is the /plugins folder containing all main plugin projects. On the other hand we have a /tests folder containing all the fragment projects that are the unit tests for their corresponding main plugin projects.
Jenkins lets me check out multiple repositories, and even to the same folder in the workspace.
The problem is that the first checkout is deleted when the second URL is checked out.
/plugins is placed into the workspace directory, then the workspace directory is "cleaned":
Cleaning local Directory .
Then the second directory /tests is checked out.
Of course I want that both folder contents are placed in the same workspace directory. How can I do that?
Assuming you're using Subversion to checkout your projects, you need to specify the "Local module directory" to something other than the default for each path you are checking out.
For example;
If you have svn://myrepo/myproject/plugins and svn://myrepo/myproject/tests, the configuration would be along the lines of;
Modules:
Repository URL : svn://myrepo/myproject/plugins
Local module directory (optional) : plugins
Repository URL : svn://myrepo/myproject/tests
Local module directory (optional) : tests
This would then inform Jenkins that it has two paths to checkout and into separate locations.
If you are trying to checkout a project into the subfolder of another working copy, you may have to use svn:externals on the parent directory.
In the new Jenkins 2.0 pipeline (previously named the Workflow Plugin), this is done differently for:
The main repository
Other additional repositories
Here I am specifically referring to the Multibranch Pipeline version 2.9.
Main repository
This is the repository that contains your Jenkinsfile.
In the Configure screen for your pipeline project, enter your repository name, etc.
Do not use Additional Behaviors > Check out to a sub-directory. This will put your Jenkinsfile in the sub-directory where Jenkins cannot find it.
In Jenkinsfile, check out the main repository in the subdirectory using dir():
dir('subDir') {
checkout scm
}
Additional repositories
If you want to check out more repositories, use the Pipeline Syntax generator to automatically generate a Groovy code snippet.
In the Configure screen for your pipeline project:
Select Pipeline Syntax. In the Sample
Step drop down menu, choose checkout: General SCM.
Select your SCM system, such as Git. Fill in the usual information
about your repository or depot.
Note that in the Multibranch Pipeline, environment variable
env.BRANCH_NAME contains the branch name of the main repository.
In the Additional Behaviors drop down menu, select
Check out to a sub-directory
Click Generate Groovy. Jenkins will display the Groovy code snippet
corresponding to the SCM checkout that you specified.
Copy this code into your pipeline script or Jenkinsfile.