Skip to content

Instantly share code, notes, and snippets.

@yrong
Created February 14, 2017 15:57
Show Gist options
  • Save yrong/b33bab4235101a3c1575078f89484137 to your computer and use it in GitHub Desktop.
Save yrong/b33bab4235101a3c1575078f89484137 to your computer and use it in GitHub Desktop.
customize pom with some linux commands
#!/usr/bin/zsh
source $HOME/.zshrc
alias mvnp="MAVEN_OPTS='-DsocksProxyHost=127.0.0.1 -DsocksProxyPort=1081' mvn -Dlicense.skip=true -DskipTests=true -Dcheckstyle.skip=true -Denforcer.skip=true -Dscalastyle.skip=true"
mvnp clean
rm -rf build
rm -rf docs
rm -rf integrationtests
rm -rf manual
rm -rf stresstests
rm -rf tools
rm -rf community/licensecheck-config
rm -rf community/neo4j-harness
rm -rf community/cypher/acceptance-spec-suite
rm -rf community/cypher/compatibility-spec-suite
rm -rf enterprise/neo4j-harness-enterprise
#--remove test source code
for file in $(find -type d -name 'test' |grep 'src'); do rm -rf $file; done
#-- remove some modules
sed -i "s/<module>integrationtests<\/module>//g" ./pom.xml
sed -i "s/<module>stresstests<\/module>//g" ./pom.xml
sed -i "s/<module>tools<\/module>//g" ./pom.xml
sed -i "s/<module>neo4j-harness<\/module>//g" ./community/pom.xml
sed -i "s/<module>licensecheck-config<\/module>//g" ./community/pom.xml
sed -i "s/<module>server-plugin-test<\/module>//g" ./community/pom.xml
sed -i "s/<module>acceptance-spec-suite<\/module>//g" ./community/cypher/pom.xml
sed -i "s/<module>compatibility-spec-suite<\/module>//g" ./community/cypher/pom.xml
sed -i "s/<module>neo4j-harness-enterprise<\/module>//g" ./enterprise/pom.xml
perl -p -i -e 's{<phase>package<\/phase>}{++$n == 2 ? "<phase>none<\/phase>" : $&}ge' ./community/server/pom.xml
#--rename file name of packages
for file in $(find -type d -name 'org' |grep 'src/main' ); do mkdir $file/../com; done
for file in $(find -type d -name 'org' |grep 'src/main' ); do mv $file $file/../com/intple; done
for file in $(find -type d -name 'neo4j' |grep 'src/main' ); do mv $file $file/../graphone; done
#-- rename package path in all files
find . -type f -exec sed -i 's/org\.neo4j/com\.intple\.graphone/g' {} +
find . -type f -exec sed -i 's/org\/neo4j/com\/intple\/graphone/g' {} +
#-- rename all SPI files
for file in $(find -type f -name 'org.neo4j*' |grep 'resources/META-INF/services'); do rename 's/org\.neo4j/com\.intple\.graphone/' $file; done
#-- change build plugin back to neo4j in pom
find . -type f -name pom.xml -exec sed -i 's/com\.intple\.graphone\.build\.plugins/org\.neo4j\.build\.plugins/g' {} +
#-- change javax ws back to neo4j in pom
find . -type f -name pom.xml -exec sed -i 's/com\.intple\.graphone\.3rdparty\.javax\.ws\.rs/org\.neo4j\.3rdparty\.javax\.ws\.rs/g' {} +
#-- remove cypher compatibility for 2.3&3.0
find -type f -name '*2_3.scala' -exec rm -r {} +
find -type f -name '*3_0.scala' -exec rm -r {} +
rm -rf community/cypher/cypher/src/main/scala/com/intple/graphone/cypher/internal/helpers
rm -rf community/cypher/cypher/src/main/scala/com/intple/graphone/cypher/internal/spi/v2_3
rm -rf community/cypher/cypher/src/main/scala/com/intple/graphone/cypher/internal/spi/v3_0
#todos:
#manully modify cypher pom and cypher code to remove dependency for 2.3&3.0
#modify packaging assembly file
#modify artifactId name in pom
#modify all shell script names
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment