Skip to content

Commit ac16c9f

Browse files
committed
Stubbed out a command line interface
1 parent 0d7184a commit ac16c9f

File tree

4 files changed

+116
-18
lines changed

4 files changed

+116
-18
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
# Ignore all Maven target directories
1+
# Ignore all build artifacts
22
**/target/
3+
**/dist/
34

45
# Ignore everything in javaxt-core-build/src/main/java
56
javaxt-core-build/src/main/java/

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ mvn clean install -Djavaxt.core.local.dir=C:\path\to\javaxt-core\src
3737

3838
```
3939

40-
**Note**: The local directory should point to the source directory containing the javaxt-core Java files (typically the `src` directory), not necessarily a Maven project. The files will be copied and compiled directly in the test project.
40+
**Note**: The local directory should point to the source directory containing the
41+
javaxt-core Java files (typically the `src` directory), not necessarily a Maven project.
42+
The files will be copied and compiled directly in the test project.
4143

4244
## Running Tests
4345

@@ -64,6 +66,20 @@ mvn test -Djavaxt.core.local.dir=/path/to/javaxt-core/src
6466
mvn test -Djavaxt.core.local.dir=C:\path\to\javaxt-core\src
6567
```
6668

69+
## Command Line Interface
70+
71+
A jar file is created during the "package" phase and can be used to interactively
72+
test javaxt-core features.
73+
74+
```bash
75+
# Build jar file (See above for more options)
76+
mvn clean package
77+
78+
# Execute tests via command line
79+
java -jar dist/javaxt-core-test.jar -test ...
80+
```
81+
82+
6783
## Contributing
6884

6985
When adding new tests:

javaxt-core-test/pom.xml

Lines changed: 77 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
</dependencies>
2727
<build>
2828
<plugins>
29+
30+
2931
<plugin>
3032
<groupId>org.apache.maven.plugins</groupId>
3133
<artifactId>maven-compiler-plugin</artifactId>
@@ -35,25 +37,94 @@
3537
<target>1.8</target>
3638
</configuration>
3739
</plugin>
40+
41+
3842
<plugin>
3943
<groupId>org.apache.maven.plugins</groupId>
4044
<artifactId>maven-antrun-plugin</artifactId>
4145
<version>3.0.0</version>
46+
<executions>
47+
48+
<execution>
49+
<id>clean-dist</id>
50+
<phase>clean</phase>
51+
<goals>
52+
<goal>run</goal>
53+
</goals>
54+
<configuration>
55+
<target>
56+
<delete dir="${project.basedir}/dist" failonerror="false"/>
57+
</target>
58+
</configuration>
59+
</execution>
60+
61+
62+
<execution>
63+
<id>move-jar</id>
64+
<phase>package</phase>
65+
<configuration>
66+
<target>
67+
<mkdir dir="${project.basedir}/../dist"/>
68+
69+
<!-- Move jar to the dist directory -->
70+
<move
71+
file="${project.build.directory}/${project.artifactId}-${project.version}.jar"
72+
tofile="${project.basedir}/../dist/${project.artifactId}.jar"
73+
/>
74+
75+
<!-- Rename javaxt-core-build-dev.jar to javaxt-core.jar in dist/lib
76+
<move
77+
file="${project.basedir}/../dist/lib/javaxt-core-build-dev.jar"
78+
tofile="${project.basedir}/../dist/lib/javaxt-core.jar"
79+
failonerror="false"/>
80+
-->
81+
</target>
82+
</configuration>
83+
<goals>
84+
<goal>run</goal>
85+
</goals>
86+
</execution>
87+
88+
</executions>
89+
</plugin>
90+
91+
92+
<plugin>
93+
<groupId>org.apache.maven.plugins</groupId>
94+
<artifactId>maven-jar-plugin</artifactId>
95+
<version>3.2.2</version>
96+
<configuration>
97+
<archive>
98+
<manifest>
99+
<mainClass>javaxt.core.test.Main</mainClass>
100+
<addClasspath>true</addClasspath>
101+
<classpathPrefix>lib/</classpathPrefix>
102+
</manifest>
103+
</archive>
104+
</configuration>
105+
</plugin>
106+
107+
108+
<plugin>
109+
<groupId>org.apache.maven.plugins</groupId>
110+
<artifactId>maven-dependency-plugin</artifactId>
111+
<version>3.1.2</version>
42112
<executions>
43113
<execution>
44-
<id>clean-dist</id>
45-
<phase>clean</phase>
114+
<id>copy-dependencies</id>
115+
<phase>package</phase>
46116
<goals>
47-
<goal>run</goal>
117+
<goal>copy-dependencies</goal>
48118
</goals>
49119
<configuration>
50-
<target>
51-
<delete dir="${project.basedir}/dist" failonerror="false"/>
52-
</target>
120+
<outputDirectory>${project.basedir}/../dist/lib</outputDirectory>
121+
<includeScope>runtime</includeScope>
53122
</configuration>
54123
</execution>
55124
</executions>
56125
</plugin>
126+
127+
57128
</plugins>
58129
</build>
59130
</project>
Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
package javaxt.core.test;
2+
import java.util.*;
23

3-
/**
4-
* Hello world!
5-
*
6-
*/
7-
public class Main
8-
{
9-
public static void main( String[] args )
10-
{
11-
System.out.println( "Hello World!" );
4+
import static javaxt.utils.Console.console;
5+
6+
public class Main {
7+
8+
public static void main(String[] arguments) {
9+
HashMap<String, String> args = console.parseArgs(arguments);
10+
11+
//System.out.println("Java Version: " + System.getProperty("java.version"));
12+
System.out.println("Java Version: " + javaxt.utils.Java.getVersion());
13+
javaxt.io.Jar jar = new javaxt.io.Jar(javaxt.io.Jar.class);
14+
System.out.println("JavaXT: " + jar.getVersion());
15+
16+
17+
String test = args.get("-test");
18+
if (test==null) return;
19+
else test = test.toLowerCase();
20+
21+
1222
}
13-
}
23+
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy