-
Notifications
You must be signed in to change notification settings - Fork 0
Builds and devopy stuff
ferng edited this page May 13, 2026
·
20 revisions
Most common build tool for Java now days, luckily they're ditching XML now so it might be less clonky.
#checksum
sha512sum apache-maven-3.6.0-bin.tar.gz
#install
mkdir ~/bin
gunzip apache-maven-3.6.0-bin.tar.gz
sudo tar -xvf apache-maven-3.6.0-bin.tar -C /opt
- Path
#linux
vi ~/.bashrc
export PATH=/opt/apache-maven-3.6.0/bin:$PATH
#windows
M2_HOME = <maven dir>
M2 = %M2_HOME%\bin
add %M2% to path
- Maven
vi ../../bin/apache-maven-3.2.1/conf/settings.xml
<localRepository>C:/Users/Fernando/Documents/.m2/repository</localRepository>- Eclipse
- preferences > maven > user settings > C:\Users\Fernando\Documents\bin\apache-maven-3.2.1\conf\settings.xml
- project properties > build path > deselect : allow output folders for source folders
mvn archetype:generate -DgroupId=com.thecrunchycorner.pricebox -DartifactId=pricebox -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false# show dependency tree
mvn dependency:tree# configure maven
vi ../../bin/apache-maven-3.2.1/conf/settings.xml
<servers>
<server>
<id>nexus</id>
<username>user</username>
<password>pw</password>
</server>
</servers>
#then push up
mvn deploy:deploy-file -Durl=http://repository/content/repositories/releases -DrepositoryId=nexus -DgroupId=crunchy -DartifactId=artifact -Dversion=2.0.0-RC1 -Dpackaging=war -Dfile=web/target/web.war
mvn deploy:deploy-file -Durl=http://repository/content/repositories/releases -DrepositoryId=nexus -DgroupId=crunchy -DartifactId=artifact -Dversion=2.0.0-RC1 -DpomFile=pom.xml -Dfile=tt-web/pom.xml
#test a package
mvn test -Dtest=com.thecrunchycorner.lmax.msgstore.*
#run a single test
mvn test -Dtest=com.thecrunchycorner.lmax.msgstore.BufferPutWrappingTest
#don't run tests
mvn install -DskipTests
#don't even compile them!!
mvn install -Dmaven.test.skip=true
#validate the project is correct and all necessary information is available
mvn validate
#compile tests
mvn test-compile
#compile everything and run tests
mvn compile
#create jar
mvn package
#install jar in my local repository
mvn install
#create site
mvn site
#remove target directory and build data
mvn clean
#process and deploy the package if necessary into an environment where integration tests can be run
mvn integration-test
#run any checks to verify the package is valid and meets quality criteria
mvn verify
#check owasps (update the version to whatever you use)
mvn org.owasp:dependency-check-maven:12.2.0:aggregate
#don't run owasp checks
mvn clean install -Ddependency-check.skip=true
#just build it
mvn clean install -Ddependency-check.skip=true -Dmaven.test.skip=trueBuild tool, specially if you want to avoid maven's endless dependencies, more like what maven is begining to be like, more scripty if you know what I mean.
- Go to: http://ant.apache.org/bindownload.cgi
- Download: apache-ant-1.9.2-bin.tar.gz
cd ~/Downloads
tar -zxvf apache-ant-1.9.2-bin.tar.gz
mv apache-ant-1.9.2 ~/bin
#unix environment variables:
vi ~/.profile
PATH=/home/fern/bin/apache-ant-1.9.2/bin:$PATH
export PATH
ANT_HOME=/home/fern/bin/apache-ant-1.9.2
export ANT_HOME
#windows environment variables:
ANT_HOME=C:\Users\gonzalezf\Documents\admin\apache-ant-1.8.2
PATH=C:\Documents\admin\apache-ant-1.8.2\bin#run build.xml in current directory
ant
#run a specific .xml file
ant -f moniDb.xml
#run a specific task
ant -f moniDB.xml doWhatYet another build tool, you can never have too many.
- Plugins
- Extended choice
- Extensible choice
- Credentials
- Git
- Deploy to container
- Promoted builds
- Configuration
- JDK path
- Git path
- Maven configuration
- Default settings prov: point to conf settings.xml
- Maven path
- Maven project:
-Xms256m -Xmx512m -Dmaven.repo.local=<local repo>
mvn dependency:purge-local-repository<properties>
...
<context.root>cdp-publication-preprocessor</context.root>
</properties>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<warName>${context.root}</warName>
<webResources>
<resource>
<!-- this is relative to the pom.xml directory -->
<directory>src/main/resources</directory>
<targetPath>WEB-INF/classes</targetPath>
</resource>
</webResources>
</configuration>
</plugin>
<profiles>
<profile>
<id>weblogic-deploy</id>
<build>
<plugins>
<plugin>
<groupId>com.oracle.weblogic</groupId>
<artifactId>weblogic-maven-plugin</artifactId>
<version>10.3.6.0</version>
<configuration>
<adminurl>t3://${wls.admin.server.host}:${wls.admin.server.port}</adminurl>
<user>${wls.user.id}</user>
<password>${wls.password}</password>
<upload>true</upload>
<action>deploy</action>
<remote>true</remote>
<verbose>true</verbose>
<targets>${wls.target.names}</targets>
<source>${project.build.directory}/${context.root}.${project.packaging}</source>
<name>${context.root}</name>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>rm -rf target/xxx.war
rm -rf pom.xml
mvn org.apache.maven.plugins:maven-dependency-plugin:3.0.0:purge-local-repository -DmanualInclude=/xxx:framework
mvn -U dependency:get -DgroupId=uk.xxx.xxx.xxx -DartifactId=xxx-xxx -Dversion=${POM_VERSION} -Dpackaging=war -Ddest=target/xxx.war
mvn -U dependency:get -DgroupId=uk.xxx.xxx.xxx -DartifactId=xxx-xxx -Dversion=${POM_VERSION} -Dpackaging=war -Ddest=pom.xml-
Install Vagrant environment:
- install virtual box: https://www.virtualbox.org/wiki/Downloads (Windows only)
- install install-vagrant-on-windows-7: http://www.vagrantup.com/downloads.html (Windows only)
-
Configure a new vagrant instance:
cmd
mkdir vagrant
cd vagrant
vagrant init ubuntu/trusty64
vagrant box add ubuntu/trusty64
vagrant up
vagrant destroy
vagrant up- putty to localhost 2222 using vagrant/vagrant
- install vagrant if necessary
- install git: http://git-scm.com/downloads (Windows only)
- install docker: git clone https://github.com/dotcloud/docker.git
sudo apt-get update
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo vim /etc/apt/sources.list.d/docker.list
deb https://apt.dockerproject.org/repo ubuntu-trusty main
sudo apt-get update
sudo apt-get install docker-engine
mkdir docker
cd docker
#new image
sudo docker pull ubuntu# docker commands
sudo docker images #list images
sudo docker ps #list containers
# start docker daemon
sudo docker daemon -H tcp://0.0.0.0:2376
sudo docker run -i -t ubuntu /bin/bash #log into docker
# add tomcat
sudo docker pull tomcat
sudo docker run -it --rm -p 8888:8080 tomcat:8.0#copy / create Dockerfile and run the command:
sudo docker build -t sporting/rabbitmq .
#to create the container we will use from now on as our test instance of rabbitmq.- set up portforward: vm(vagrant):5672 -> host_running_tests:5672
- set up portforward: vm(vagrant):15672 -> host_running_tests:15672
- bring up the VM: vagrant up (windows only)
- then manage docker:
#bring up docker
docker run -d -p 15672:15672 -p 5672:5672 fern/crunchy
#run your tests, then shutdown docker
docker stop `docker ps -a|grep "fern/crunchy"|cut -b 1-12`- Create documentation
javadoc -d doc com.thecrunchycorner.sdkPrepare node for a production server deployment.
# make application directory
/home/pi/apps/runlog