Jun 21, 2013

[memo] How to delete old files in Linux

find ./ -mtime +60 -name "*.log" | xargs mv --target-directory=/tmp
cd /tmp
rm *.log
# or run the following command
find ./ -mtime +60 -name "*.log" | xargs rm -f

Jun 7, 2013

maven scala java mixed project

I develop my product with Java and have test code written by Scala(Specs2). I wanted run test cases on my PC and Jenkins.
I have got some problems and solved by the following pom.xml. It works well. I hope this helps you.

Don't forget add "@RunWith(classOf[JUnitRunner])" to your xxxSpec class.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>baepiff</groupId>
<artifactId>sample</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
<maven.compiler.target>1.7</maven.compiler.target>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.debug>true</maven.compiler.debug>
<maven.compiler.optimize>true</maven.compiler.optimize>
<maven.compiler.showDeprecations>true</maven.compiler.showDeprecations>
</properties>
<repositories>
<repository>
<id>public</id>
<name>Internal Repository</name>
<url>http://localhost/nexus/content/groups/public/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>public</id>
<name>Internal Repository</name>
<url>localhost/nexus/content/groups/public/</url>
</pluginRepository>
</pluginRepositories>
<scm>
<connection>scm:git:git@localhost:baepiff/sample.git</connection>
<url>scm:git:git@localhost:baepiff/sample.git</url>
<developerConnection>scm:git:git@localhost:baepiff/sample.git</developerConnection>
</scm>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
<configuration>
<encoding>${maven.compiler.encoding}</encoding>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<debug>${maven.compiler.debug}</debug>
<optimize>${maven.compiler.optimize}</optimize>
<showDeprecation>${maven.compiler.showDeprecations}</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>com.mmakowski</groupId>
<artifactId>maven-specs2-plugin</artifactId>
<version>0.4.1</version>
<executions>
<execution>
<id>verify</id>
<phase>verify</phase>
<goals>
<goal>run-specs</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<executions>
<execution>
<id>scala-compile-first</id>
<phase>process-resources</phase>
<goals>
<goal>add-source</goal>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>scala-test-compile</id>
<phase>process-test-resources</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/*Spec.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.specs2</groupId>
<artifactId>specs2_2.10</artifactId>
<version>1.14</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.10.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
view raw pom.xml hosted with ❤ by GitHub