Donnerstag, 28. März 2019

Scan Files For Search Terms - Java Program Code + Download


I have written a small progam to help us out. Download

Maven - How to create Maven Java Project From Scratch

Install Maven, go to the Apache Site

In your command line enter: 

D:\>mvn archetype:generate -DgroupId=de.consulting.it.harder -DartifactId=java-project -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

This will create a basic Maven project from scratch.

Update your POM with the following properties to define the Compiler:

    <properties>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.compiler.source>1.8</maven.compiler.source>
    </properties>


Define JUnit as your first dependency for Testing with scope "test":

    <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<scope>test</scope>
    </dependency>


I suggest Hamcrest, if you do not know it yet:


     <!-- https://mvnrepository.com/artifact/org.hamcrest/hamcrest-all -->               
    </dependency>
        <groupId>org.hamcrest</groupId>
        <artifactId>hamcrest-all</artifactId>
        <version>1.3</version>        
        <scope>test</scope>
    </dependency>

If you want to package as executable JAR:
$ mvn clean package

If you want to start the  JAR:
$ java -jar <your jar file name here> 

Here is the POM with all attributes for executable JARs: Download Example POM

Dienstag, 19. März 2019

How To Resolve GIT Merge Conflicts with IntelliJ

Resolve a Merge Conflict in GIT with IntelliJ


Let us assume you are using Bitbucket or a similar tool to administrate and host your GIT repositories.
You are using the Open Source principle with Pull Request, Review, Merge: 
  • Push changes
  • Assign a reviewer or two
  • Depending on your team agreement, either you or the reviewer will merge the feature onto your main develop branch (I will call it "develop"). The pull request is merged.

In some cases there will be incompatible changes which happened on the develop branch when you are about to merge.
The pull request cannot be merged due to merge conflicts with your develop branch.

1) Checkout the current develop branch from remote locally.
2) Checkout the feature branch locally
3) When you have switched to your feature branch, use this command:
$git merge develop
4) The merge conflicts are now shown.
5) Use IntelliiJ Merge Tool to resolve the merge conflicts: https://www.jetbrains.com/help/idea/resolving-conflicts.html
Note: there is also the standard GIT merge-tool which will work as a stand-alone without an IDE.
6) Push everything to your remote feature branch
7) Merge the pull request via Bitbucket or other tool.

NEW BLOG! http://cleancode.consulting/

Dear Reader, This Blog is closed and remains as an archive. Please find our new Blog at  http://cleancode.consulting/