Skip to content

Commit c535ff2

Browse files
committed
Added maven support.
1 parent cdf7b90 commit c535ff2

36 files changed

+65
-15
lines changed

build.xml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,18 @@
1717
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1818
-->
1919

20-
<project name="JS-Collider">
20+
<project name="js-collider">
2121

22-
<property name="VERSION" value="0.92"/>
23-
<property name="OUT_DIR" location="out/production"/>
22+
<xmlproperty file="pom.xml" prefix="pom"/>
23+
<property name="VERSION" value="${pom.project.version}"/>
24+
<property name="OUT_DIR" location="target"/>
2425

2526
<macrodef name="run-test">
2627
<attribute name="name"/>
2728
<sequential>
2829
<java classname="org.jsl.tests.@{name}.Main" fork="true">
2930
<classpath>
30-
<pathelement location="${OUT_DIR}/core"/>
31+
<pathelement location="${OUT_DIR}/classes"/>
3132
<pathelement location="${OUT_DIR}/tests"/>
3233
</classpath>
3334
<jvmarg value="-ea"/>
@@ -38,24 +39,24 @@
3839
</macrodef>
3940

4041
<target name="clean">
41-
<delete dir="out"/>
42+
<delete dir="${OUT_DIR}"/>
4243
</target>
4344

4445
<target name="compile">
45-
<mkdir dir="${OUT_DIR}/core"/>
46-
<javac srcdir="core/src" destdir="${OUT_DIR}/core" includeantruntime="false" debug="true"/>
46+
<mkdir dir="${OUT_DIR}/classes"/>
47+
<javac srcdir="src/main/java" destdir="${OUT_DIR}/classes" includeantruntime="false" debug="true"/>
4748
</target>
4849

49-
<target name="dist" depends="compile">
50-
<jar jarfile="out/${ant.project.name}-${VERSION}.jar" basedir="${OUT_DIR}/core">
50+
<target name="package" depends="compile">
51+
<jar jarfile="${OUT_DIR}/${ant.project.name}-${VERSION}.jar" basedir="${OUT_DIR}/classes">
5152
<manifest>
5253
<attribute name="Implementation-Title" value="${ant.project.name}"/>
5354
<attribute name="Implementation-Vendor" value="org.jsl"/>
5455
<attribute name="Implementation-Version" value="${VERSION}"/>
5556
<attribute name="Sealed" value="true"/>
5657
</manifest>
5758
</jar>
58-
<jar jarfile="out/${ant.project.name}-${VERSION}-src.jar" basedir="core/src">
59+
<jar jarfile="${OUT_DIR}/${ant.project.name}-${VERSION}-sources.jar" basedir="src/main/java">
5960
<manifest>
6061
<attribute name="Implementation-Title" value="${ant.project.name}"/>
6162
<attribute name="Implementation-Vendor" value="org.jsl"/>
@@ -69,7 +70,7 @@
6970
<mkdir dir="${OUT_DIR}/tests"/>
7071
<javac srcdir="tests/src" destdir="${OUT_DIR}/tests" includeantruntime="false" debug="true">
7172
<classpath>
72-
<pathelement location="${OUT_DIR}/core"/>
73+
<pathelement location="${OUT_DIR}/classes"/>
7374
</classpath>
7475
</javac>
7576
</target>

pom.xml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<groupId>org.jsl.collider</groupId>
6+
<artifactId>js-collider</artifactId>
7+
<packaging>jar</packaging>
8+
9+
<name>js-collider</name>
10+
<version>0.93</version>
11+
<url>https://github.com/js-labs/js-collider</url>
12+
<description>NIO framework</description>
13+
14+
<properties>
15+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
16+
</properties>
17+
18+
<dependencies>
19+
<dependency>
20+
<groupId>junit</groupId>
21+
<artifactId>junit</artifactId>
22+
<version>3.8.1</version>
23+
<scope>test</scope>
24+
</dependency>
25+
</dependencies>
26+
27+
<build>
28+
<plugins>
29+
30+
<plugin>
31+
<groupId>org.apache.maven.plugins</groupId>
32+
<artifactId>maven-source-plugin</artifactId>
33+
<version>2.4</version>
34+
<executions>
35+
<execution>
36+
<id>attach-sources</id>
37+
<goals>
38+
<goal>jar</goal>
39+
</goals>
40+
</execution>
41+
</executions>
42+
</plugin>
43+
44+
</plugins>
45+
</build>
46+
47+
</project>

core/src/org/jsl/collider/AcceptorImpl.java renamed to src/main/java/org/jsl/collider/AcceptorImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
import java.util.logging.Logger;
3535

3636

37-
public class AcceptorImpl extends SessionEmitterImpl
37+
class AcceptorImpl extends SessionEmitterImpl
3838
implements ColliderImpl.ChannelHandler
3939
{
4040
private class ChannelAcceptor extends ThreadPool.Runnable

core/src/org/jsl/collider/ColliderImpl.java renamed to src/main/java/org/jsl/collider/ColliderImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ public void removeDatagramListenerNoWait( final DatagramListener datagramListene
320320
}
321321
}
322322

323-
private static final Logger s_logger = Logger.getLogger( "org.jsl.collider.Collider" );
323+
private static final Logger s_logger = Logger.getLogger( Collider.class.getName() );
324324

325325
private static final AtomicReferenceFieldUpdater<ColliderImpl, SelectorThreadRunnable> s_strHeadUpdater =
326326
AtomicReferenceFieldUpdater.newUpdater( ColliderImpl.class, SelectorThreadRunnable.class, "m_strHead" );

tests/src/org/jsl/tests/byte_buffer_pool/Main.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,15 @@
2020
import org.jsl.collider.RetainableByteBuffer;
2121
import org.jsl.collider.RetainableByteBufferPool;
2222
import org.jsl.tests.Util;
23-
23+
import java.util.logging.Logger;
2424
import java.util.concurrent.Semaphore;
2525
import java.util.concurrent.atomic.AtomicReference;
2626

2727
public class Main
2828
{
29+
private static final Logger s_logger = Logger.getLogger( Main.class.getName() );
2930
private static final int OPS = 1000000;
31+
3032
private final Semaphore m_sema;
3133
private final RetainableByteBufferPool m_pool;
3234
private ReleaseThread m_releaseThread;
@@ -174,7 +176,7 @@ private void run()
174176
ex.printStackTrace();
175177
}
176178

177-
System.out.println( m_pool.clear() );
179+
System.out.println( s_logger );
178180
}
179181

180182
public static void main( String [] args )

0 commit comments

Comments
 (0)