Skip to content

Commit 40242f1

Browse files
authored
Merge pull request #6 from nschlimm/feature/maven
Feature/maven
2 parents 638c61a + 1cd3801 commit 40242f1

File tree

4 files changed

+155
-2
lines changed

4 files changed

+155
-2
lines changed
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
#!/bin/bash
2+
3+
useFull() {
4+
echo "Usefull stuff to remember:"
5+
echo
6+
echo "Printout mappings at application start:"
7+
echo -e " \n
8+
@EventListener \n
9+
public void handleContextRefresh(ContextRefreshedEvent event) { \n
10+
ApplicationContext applicationContext = event.getApplicationContext(); \n
11+
RequestMappingHandlerMapping requestMappingHandlerMapping = applicationContext \n
12+
.getBean("requestMappingHandlerMapping", RequestMappingHandlerMapping.class); \n
13+
Map<RequestMappingInfo, HandlerMethod> map = requestMappingHandlerMapping \n
14+
.getHandlerMethods(); \n
15+
map.forEach((key, value) -> log.info("{} {}", key, value)); \n
16+
}"
17+
}
18+
19+
showProperties() {
20+
selectItem "find ./src -type f -name 'application*.*'" "awk '{print \$1}'"
21+
if [[ $fname == "" ]]; then return 0; fi
22+
vim "$fname"
23+
}
24+
25+
mvnCleanEclipse(){
26+
mvn clean:clean
27+
mvn eclipse:clean
28+
mvn eclipse:eclipse
29+
}
30+
31+
startSpringBoot() {
32+
echo "Which profile?"
33+
read defprofiles
34+
my_array=("logging.level.root=DEBUG" \
35+
"logging.level.web=DEBUG" \
36+
"logging.level.sql=DEBUG" \
37+
"logging.level.web=TRACE" \
38+
"logging.level.sql=TRACE" \
39+
"spring.jpa.show-sql=true" \
40+
"logging.level.org.springframework=DEBUG" \
41+
"management.endpoints.web.exposure.include=mappings" \
42+
"logging.group.tomcat=org.apache.catalina,org.apache.coyote,org.apache.tomcat,--logging.level.tomcat=DEBUG" \
43+
"logging.level.org.hibernate=DEBUG" \
44+
"logging.level.org.springframework.boot.autoconfigure=DEBUG" \
45+
"logging.level.org.springframework.test.context.jdbc=DEBUG" \
46+
"logging.level.org.springframework.jdbc.datasource.init=DEBUG" \
47+
"spring.jpa.hibernate.ddl-auto=validate" \
48+
"spring.jpa.properties.hibernate.generate_statistics=true,--logging.level.org.hibernate.stat=DEBUG,--spring.jpa.properties.hibernate.session.events.log.LOG_QUERIES_SLOWER_THAN_MS=1,--logging.level.org.hibernate.SQL=DEBUG,--logging.level.org.hibernate.cache=DEBUG")
49+
concatenated=$(printf "%s\n" "${my_array[@]}")
50+
selectItem 'printf "%s\n" "${my_array[@]}"' "awk '{print \$1}'"
51+
if [[ $fname == "" ]]; then return 0; fi
52+
executeCommand "SPRING_PROFILES_ACTIVE="$defprofiles" mvn spring-boot:run -Dspring-boot.run.arguments=--"$fname""
53+
}
54+
55+
showGlobalSettings(){
56+
OUTPUT="$(mvn -X | grep -F '[DEBUG] Reading global settings from')"
57+
echo ${OUTPUT:37}
58+
read -p "Open global settings? " -n 1 -r
59+
echo # (optional) move to a new line
60+
if [[ $REPLY =~ ^[Yy]$ ]]
61+
then
62+
vim ${OUTPUT:37}
63+
fi
64+
}
65+
66+
showLocalSettings() {
67+
OUTPUT="$(mvn -X | grep -F '[DEBUG] Reading user settings from')"
68+
echo ${OUTPUT:35}
69+
read -p "Open user settings? " -n 1 -r
70+
echo # (optional) move to a new line
71+
if [[ $REPLY =~ ^[Yy]$ ]]
72+
then
73+
vim ${OUTPUT:35}
74+
fi
75+
}
76+
77+
downLoadSources() {
78+
mvn dependency:sources
79+
mvn eclipse:eclipse -DdownloadSources=true
80+
}
81+
82+
toRepo() {
83+
repo=$(mvn help:evaluate -Dexpression=settings.localRepository | grep -v '\[INFO\]')
84+
cd "$repo"
85+
echo "Now in: $(pwd)"
86+
exit
87+
}
88+
89+
newProject() {
90+
echo "Command expects the user to be in the new cloned repo folder. <taste drücken>"
91+
read
92+
echo "Project name?"
93+
read projektname
94+
mvn archetype:generate -DartifactId=$projektname \
95+
-DinteractiveMode=true
96+
mv $projektname/* .
97+
rm -rf $projektname/
98+
mvn compile
99+
mvn eclipse:eclipse
100+
git status > .gitignore
101+
vim .gitignore
102+
break
103+
}

EasyKey.maven/maven.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
#####################################
4+
# EasyKey.maven utility main script #
5+
#####################################
6+
7+
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
8+
source "$script_dir/../shellmenu.sh"
9+
source "$script_dir/ezk-maven-functions.sh"
10+
11+
menuInit "Super MAVEN Home"
12+
submenuHead "Maven:"
13+
menuItemClm a "Clean all eclipse" "mvnCleanEclipse" b "Maven analyze dependencies" "mvn dependency:analyze"
14+
menuItemClm c "Clean install force updates" "mvn clean install -U -DskipTests" d "To maven repo" toRepo
15+
menuItemClm e "Show effective settings" "mvn help:effective-settings" f "Local repo location" "mvn help:evaluate -Dexpression=settings.localRepository | grep -v '\[INFO\]'"
16+
menuItemClm g "Show global settings" showGlobalSettings h "Show local settings" showLocalSettings
17+
menuItemClm i "Re-resolve project dependencies" "mvn dependency:purge-local-repository" j "List repositories" "mvn dependency:list-repositories"
18+
menuItemClm k "Download sources" downLoadSources l "Build with deps" "mvn clean compile assembly:single"
19+
menuItemClm m "New project from archetype" newProject p "Effective pom" "mvn help:effective-pom"
20+
menuItemClm t "Dependency tree" "mvn dependency:tree" u "Display dependency updates" "mvn versions:display-dependency-updates -DexcludeReactor=true"
21+
submenuHead "Lifecycle:"
22+
menuItemClm C "Clean compile" "mvn clean compile" T "Clean test" "mvn clean test"
23+
menuItemClm I "Clean install" "mvn clean install -DskipTests" P "Clean package" "mvn clean package -DskipTests"
24+
menuItem D "Clean deploy" "mvn clean deploy -DskipTests"
25+
submenuHead "Spring-Boot:"
26+
menuItemClm o "Start Spring Boot App" startSpringBoot s "View application properties" showProperties
27+
menuItem v "Usefull notes" useFull
28+
startMenu "$(pwd)"

shellmenu.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ submenuHead () {
7878
# Prints the menu item to standard out.
7979
#################################################
8080
menuItem () {
81-
menudatamap+=("$1$delimiter$2$delimiter$3$delimiter$actualsubmenuname$delimiter$actualmenu$delimiter1")
81+
menudatamap+=("$1$delimiter$2$delimiter$3$delimiter$actualsubmenuname$delimiter$actualmenu${delimiter}1")
8282
${immediateMode} && printMenuItem "$1" "$2"
8383
}
8484

@@ -112,14 +112,17 @@ menuItemClm () {
112112
#################################################
113113
# The entry method to display the menu in non
114114
# immediate mode (the default mode)
115+
# Arguments:
116+
# $1: a custom output at the bottom of menu
117+
# (e.g. current directory)
115118
# Outputs:
116119
# the menu written to stdout
117120
#################################################
118121
startMenu() {
119122
while ${continuemenu:=true}; do
120123
clear
121124
generateMenu
122-
choice
125+
choice "$1"
123126
done
124127
}
125128

@@ -474,6 +477,10 @@ terminate () { continuemenu=false; }
474477
# and initiates execution of command selected
475478
#################################################
476479
choice () {
480+
if [ -n "$1" ]; then
481+
echo
482+
importantLog "$1"
483+
fi
477484
echo
478485
echo "Press 'q' to quit"
479486
echo

simplest_example.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
########################
4+
# Simplest example #
5+
########################
6+
7+
source "./shellmenu.sh"
8+
9+
clear
10+
menuItem c "Clean all" "mvn clean:clean"
11+
menuItem x "Compile" "mvn clean compile"
12+
menuItem t "Test" "mvn clean test"
13+
menuItem i "Install" "mvn clean install"
14+
startMenu
15+
echo "bye, bye, homie!"

0 commit comments

Comments
 (0)