bash

Custom Maven Starter Archetype

Create Maven Archetype

  • create an empty Maven project
mvn archetype:generate \
    -DgroupId=nl.appall.java \
    -DartifactId=java \
    -DarchetypeArtifactId=maven-archetype-quickstart \
    -DinteractiveMode=false

  • modify the pom file with for example to add Junit5 and Java 11.
<properties>
    <maven.compiler.source>11</maven.compiler.source>
    <maven.compiler.target>11</maven.compiler.target>
</properties>

<dependencies>
    <!-- JUnit Jupiter API for writing tests -->
    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-api</artifactId>
        <version>5.7.0</version>
        <scope>test</scope>
    </dependency>

    <!-- JUnit Jupiter Engine for running tests -->
    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-engine</artifactId>
        <version>5.7.0</version>
        <scope>test</scope>
    </dependency>
</dependencies>

  • Use the maven-archetype-plugin to create an archetype from your project:
mvn archetype:create-from-project
  • Deploy the generated archetype to a repository (local or remote) so it can be reused:
mvn install
  • create a Maven Settings file
mkdir -p ~/.m2
echo '<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
  <localRepository/>
  <interactiveMode/>
  <usePluginRegistry/>
  <offline/>
  <pluginGroups/>
  <servers/>
  <mirrors/>
  <proxies/>
  <profiles/>
  <activeProfiles/>
</settings>' > ~/.m2/settings.xml

use your archetype to generate a new project like:

mvn archetype:create-from-project

In bashrc

To automate the creation of a new blank project with your custom archetype you can update your bashrc like ~/.zshrc

march() {
         if [ -z "$1" ]; then
             echo "Error: No project name provided."
             echo "Usage: march <projectname>"
            return 1
        fi

        mvn archetype:generate \
            -DarchetypeGroupId=nl.appall.java \
            -DarchetypeArtifactId=java-archetype \
            -DarchetypeVersion=1.0-SNAPSHOT \
            -DgroupId=nl.appall.newproject \
            -DartifactId=$1 \
            -Dversion=1.0-SNAPSHOT \
            -DinteractiveMode=false

        cd $1
        idea .
   }

now march yourProject creates the project , gets in the folder and starts intellij.

Git master main

Rename to main

git branch -m main 

push to origin

git push origin -u main

Update config

git config --global init.defaultBranch main

delete master

git branch -d master
Tags: 

Windows cli check for running at port 1234

netstat -ano | findstr :<PORT>
tskill typeyourPIDhere 
or taskkill /PID 14328 /F

heic convert

# convert any HEIC image in a directory to jpg format
magick mogrify -monitor -format jpg *.HEIC

# convert an HEIC image to a jpg image
magick convert example_image.HEIC example_image.jpg

Icon create

after: brew install imagemagick
create iconcreate.sh

#!/bin/bash
for size in {76,40,29,60,57,50,72,167}; do for scale in {1,2,3}; do
    if [[ $scale == 1 ]]; then
        filename="icon_${size}.png"
    else
        filename="icon_${size}@${scale}x.png"
    fi
    gm convert "icon.png" -resize "$(( $scale * $size ))x$(( $scale * $size ))" $
done; done

or
sh iconcreate.sh icon.png

convert $1 -resize 16x16      Icon-16.png
convert $1 -resize 32x32      Icon-16@2x.png
convert $1 -resize 29x29      Icon-Small-29.png          # Settings on iPad and iPhone, and Spotlight on iPhone
convert $1 -resize 58x58      Icon-Small-29@2x.png
convert $1 -resize 87x87      Icon-Small-29@3x.png
convert $1 -resize 32x32      Icon-32.png
convert $1 -resize 64x64      Icon-32@2x.png
convert $1 -resize 40x40      Icon-Small-40.png       # Spotlight
convert $1 -resize 80x80      Icon-Small-40@2x.png       # Spotlight
convert $1 -resize 120x120    Icon-Small-40@3x.png       # Spotlight
convert $1 -resize 50x50      Icon-Small-50.png       # Spotlight on iPad 1/2
convert $1 -resize 57x57      Icon-57.png                # Home screen on non-Retina iPhone/iPod
convert $1 -resize 114x114    Icon-57@2x.png             # Home screen for Retina display iPhone/iPod
convert $1 -resize 120x120    Icon-60@2x.png          # Home screen on iPhone/iPod Touch with retina display
convert $1 -resize 180x180    Icon-60@3x.png          # Home screen on iPhone 6 Plus
convert $1 -resize 72x72      Icon-72.png             # App Store and Home screen on iPad
convert $1 -resize 144x144    Icon-72@2x.png          # Home screen for "The New iPad"
convert $1 -resize 76x76      Icon-76.png             # Home screen on iPad
convert $1 -resize 152x152    Icon-76@2x.png          # Home screen on iPad with retina display
convert $1 -resize 228x228    Icon-76@3x.png
convert $1 -resize 83.5x83.5  Icon-83,5.png
convert $1 -resize 167x167    Icon-83,5@2x.png
convert $1 -resize 128x128    Icon-128.png
convert $1 -resize 256x256    Icon-128@2x.png
convert $1 -resize 256x256    Icon-256.png
convert $1 -resize 512x512    Icon-256@2x.png
convert $1 -resize 512x512    Icon-512.png
convert $1 -resize 1024x1024  iTunesArtwork@2x.png   # App list in iTunes for devices with retina display
convert $1 -resize 1024x1024  Icon-512@2x.png
convert $1 -resize 512x512    iTunesArtwork.png       # Ad Hoc iTunes

Subscribe to RSS - bash