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.
Related
I have checked in one of my projects to GIT repo. When i cloned it from GIT, imported the project to eclipse and converted the project to Maven Project, the folder structure of maven seems to be a bit different
This should have been src/main/java, src/test/java, src/test/respurces folder structures and com.vod... as package.
I have tried maven>update project, project>clean, maven>clean, eclipse::clean, eclipse::eclipse. But this project structure does not seem to go off.
Any possible solutions for this please?
After importing the project as eclipse general project, below is the structure.
This is a typical problem due to the lack of Eclipse metadata files in the GIT repository.
How to solve it:
Open the project's contextual menu > Java Build Path > Configure Build Path > Source. Drop off folder src and set as folder sources just these:
src\main\java
src\main\resources
src\test\java
src\test\resources
This will save some metadata to the .classpath file.
Also, you should ensure that this was set as a Maven project: Open the project's contextual menu > Configure. If there is the Convert to Maven command, execute it (if not, it is already a Maven project). This might save some metadata to the .project file.
Then, be sure to check in the Eclipse metadata files (.classpath, .project and .settings folder) to GIT. And, in order for this project can be safely shared to other developers, be sure not to enter absolute paths in the java build path, nor other system-dependant constraints.
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.
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.
I have a Leiningen project that is dependent on another Leiningen project. Both are on Github. I cloned the project I am dependent on to the checkouts folder as a Git submodule, which works great in my development environment. I can use the classes from the dependency without even having to add it as a dependency in projects.clj (despite the fact that the documentation says "If you have a project in checkouts without putting it in :dependencies then its source will be visible but its dependencies will not be found").
The main problem is that when I push the project to Heroku, the submodules are cloned automatically but there is no checkouts directory under /app. I guess that Heroku ignores checkouts for some reason.
Presumably I am doing this wrong and there's a right way for me to work in parallel with two Git repos, one of which is dependent on the other. The main issue for me is that I need to be able to deploy my app easily to Heroku. What is the standard way to deal with this situation?
Update: I also noticed that my circle.yml file, which is in the repo, is not in the /app directory. I'm totally confused about what exactly is in the /app directory and where the other stuff disappeared to.
The problem is that heroku runs lein with-profile production compile :all which ignores checkout dependencies (see https://github.com/technomancy/leiningen/issues/1263).
A possible solution is to add :checkout-deps-shares [:source-paths] to your production profile. It's discouraged (according to heroku engineers you really should use an uberjar in production) but it should do the trick.
I am having an eclipse project created on Ubuntu, in which all the JARs that I am using, are located in a folder /home/xyz/AllJARs. Here the /home is the system home folder. The project as well as the AllJARs folder is git version controlled on a central git server.
So, all the paths to these JARs in the project's build path are /home/xyz/AllJARs. When I'm cloning the project repo and the AllJARs repo on a Windows machine, I'm shown errors related to build path since it can't find the path /home/xyz/AllJARs.
How can I manage this situation where I can have external JAR files in build paths which can work on Ubuntu as well as on a Windows machine? Thanks in advance.
You have two easy options:
use relative paths: for example, put the JAR folder in the folder above your project, then you can set the JARs' paths to ../AllJARs/
put JARs into project: you can also just put the JARs into the project folder; if you've set them up as "External JARs" in project settings, you'll have to remove them from that list, and re-add them with "Add JARs". Eclipse will then look for them locally in the project folder. If you don't want to commit the JARs to the git repo (size and/or permission being a problem), you can just copy them into the Project folder after cloning. While they're not there, you'll be shown a warning, but once Eclipse can find them, everything's fine.