My .hgignore file looks like this:
syntax: glob
# mercurial files
*.orig
*.rej
# build target and dependency directories
*/target/**
*/target-eclipse/**
.gradle/**
.gradle
*.war
*/wrapper/**
!gradle/wrapper/gradle-wrapper.jar
!gradle/wrapper/gradle-wrapper.properties
*/out/**
*/build/**
# IDE files
.idea/**
.settings/**
*.iml
*.ipr
*.iws
*.classpath
*.project
# LazyBones
.lazybones/**
# DropWizard
config.yml
config.json
# JMeter Results
*/jmeter/results/*
Pay attention to my attempt to exclude gradle/wrapper/* from this ignore file:
!gradle/wrapper/gradle-wrapper.jar
!gradle/wrapper/gradle-wrapper.properties
When I run gradle wrapper on my project it generates typical Gradle wrapper files. However when I hg add I don't see those files (gradle-wrapper.jar and gradle-wrapper.properties) added to hg tracking, and when I push my project (hg push) I don't see them showing up on the remote repo.
Have I misconfigured .hgignore somehow? is hg still actually ignoring my Gradle wrapper artifacts?
For two specific files, you should just add them manually:
hg add gradle/wrapper/gradle-wrapper.jar gradle/wrapper/gradle-wrapper.properties
hg commit
This will work even if they are ignored, and changes will be picked up by subsequent commits automatically.
Related
I'm using gitignore, and I'm good at push and pull for personal management.
The focus is on my own creation, so I have all the configuration files, so it runs well locally.
However, if I "Clone" this project and download it to an empty folder, it cannot be run anywhere.
It seems as if there is no configuration file necessary for project configuration or server execution.
I am attaching my gitignore.
Is this what gitignore originally intended?
I want to clone a project so that it can run.
Do I have to delete gitignore to do that?
p.s If I delete gitignore and clone all projects (including build artifacts) it works fine.
use tool & etc : Intellij, Spring, Tomcat
### Java template
*.class
# Package Files #
*.jar
*.war
*.ear
### macOS template
*.DS_Store
.AppleDouble
.LSOverride
# IntelliJ project files
.idea
.idea/*.xml
*.iml
out
gen
build
rebel.xml
# Compliled files
/target/
**/target
/example/
# Gradle
.gradle
/build/
.gradletasknamecache
Normally, you don't distribute compiled binaries with your git repo. The convention is to either have users compile the code locally, or distribute that code using a package management system like Maven, Ivy, npm, Nuget, pip or gem. This isn't a hard and fast rule however.
I am trying to use caching in gitlab runner, which builds a Maven Java project. Currently Gitlab runner only allow caching specific paths defined in gitlab yaml file in the cache: clause. When maven builds projects, it generate everything inside target/ folder, which are untracked files in git. So I can simply use untracked: true option to cache everything under target/ folder. The purpose of caching is to skip compiling the files, which have already been compiled by maven under the target/ folder.
However this cache amounts to about 6GB, which is completely unreasonable for its size and time required to create and restore such a giant cache. It caches all jar and war artifacts built during compiling multi-module maven project. However, maven only needs .class files to check changes for re-compilation
So if their was some way using which I can cache only *.class files, and make them available in subsequent builds, then maven could check the .class files and skip re-compiling unchanged files and cache size would also be pretty small. Currently gitlab-runner only allow specifying absolute paths for caching. It does not support regex patterns for paths such as \.class$ (which would have been very useful).
Is there any way I could cache only specific file types using gitlab runner yaml settings?
So based on cascaval's comment, I was able to figure out a solution.
At the end of maven build I ran a command to clean all build artifacts created by maven, which are not used for checking stale status of .java resources. Here is what I wrote -
cd ./projects/directory
find . | grep --perl-regexp --regexp='\/target\/(?!classes|maven)' | xargs rm --recursive --force
This saves all .class files in target/classes folder, including folder structure and also files in maven-status folder, which are probably used by maven to check file status for recompilation.
Is it possible that I could use mercurial (hg) to ignore the changes on my local but always get the latest one and remind me of the changes when conflicts?
e.g. I have a pom.xml file which use a less plugin, but I definitely dont want the less plugin get run every time when I change a file in the eclipse and it triggers the maven update. But I will need it when it goes to production.
So is it possible I could just ignore my changes on the pom.xml file (comment out the less plugin) but not commit it and still get the updates when some other changes on pom.xml incoming.
You can't do this with .hgignore, as that only instructs Mercurial which untracked files to ignore.
You can achieve what you want by not committing changes to pom.xml:
hg commit --exclude pom.xml
You'll need to remember to will be a manual operation every commit, or you can add something like the following to your .hgrc or Mercurial.ini:
[alias]
mycommit = commit --exclude pom.xml
hg mycommit will now always exclude pom.xml
I want to put my setting files in to the Git repository so I can sync them between my computers. I have the following folder structure:
d:\settings\
.git
plugins\
.git
other_things\
So, settings and plugins are separate git repositories. To track plugins folder without using submodules, I run the following command as per this post:
git add plugins/
Everything was fine, I was able to 'see' the files from plugins folder within settings up until I tried to sync it to my other computer, where plugins folder was missing its own .git directory.
Is it possible to include (exclude from .gitignore) .git folder via .gitignore somehow? I tried to use something like:
!..\.git
but it didn't work.
Thanks.
You should use submodule or subtree for that purpose. You can read more about submodules here:
http://git-scm.com/docs/git-submodule
We have a maven project for which we have set up jenkins for build. The reporsitory has a large tools folder which i didn't want Jenkins to download.
I just want jenkins to download src folder and pom.xml file.
I added two reporsitory locations in Jenkins - only to learn that Single file checkouts are not possible
This forced me to use shell script option provided by Jenkins for checking out pom .xml . PFB the script outline.
svn checkout $pomUrl . --depth empty
svn update pom.xml
I did not find an option in my scm plugin of Jenkins to do an empty checkout
Checkout one file from Subversion
But POLL SCM of jenkins is only polling the src folder and builds are not triggered if i make some changes to pom.xml. Is there a way to ensure Polling of my pom.xml as well?
No. Jenkins will poll what it knows.
In your scenario:
Jenkins doesn't know about your pom.xml.
Jenkins doesn't work in single file checkouts anyways.
You will have to rearrange your structure, either move the tools folder outside of the main checkout (if it's so large that it's prohibitive, why do you have it in the root location?), or move the pom.xml into the src folder.
Edit:
Here is an idea. Haven't tried so don't know if that will work.
Keep your manual checkout and update of that pom like you currently do.
Setup another SVN Add module....
Enter the root location of SVN where your pom is, give it a non-conflicting folder name
Configure Repository depth for that module as Empty (if you don't see this option, you may need to upgrade your SVN plugin and/or Jenkins).
Click Advanced... section.
Configure Included Regions with the path to your src folder, and the pom only.
Something like:
/trunk/myapp/src/.*
/trunk/myapp/pom.xml