Skip to content

Commit 5191708

Browse files
authored
Merge pull request #4 from djvelimir/feature/add-maven-dependency-plugin
Add Maven dependency plugin
2 parents 3873ddd + 551a10a commit 5191708

File tree

4 files changed

+46
-14
lines changed

4 files changed

+46
-14
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ jobs:
2222
tag_name: ${{ github.ref }}
2323
release_name: Release ${{ github.ref }}
2424
body: |
25-
We are excited to announce the initial release of java-demo-cli, a command-line application designed to simplify password generation! This tool generates secure, random passwords of 16 characters to enhance your online security. With just a simple command, users can get a strong password that includes a mix of uppercase letters, lowercase letters, numbers, and special characters. Say goodbye to weak passwords and the headache of remembering them—java-demo-cli is here to streamline your password management effortlessly! Download it now and take your first step towards improved security.
25+
**Release Notes:**
26+
- Added the Maven Dependency Plugin to automatically create a target/lib folder containing all project dependencies. This enhancement streamlines the packaging process, making it easier to manage and include external libraries required for project execution.
2627
draft: false
2728
prerelease: false

pom.xml

Lines changed: 42 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>org.example</groupId>
88
<artifactId>demo-java-cli</artifactId>
9-
<version>1.0-SNAPSHOT</version>
9+
<version>1.0.1</version>
1010

1111
<name>demo-java-cli</name>
1212
<url>https://djvelimir.github.io</url>
@@ -80,20 +80,10 @@
8080
<plugin>
8181
<artifactId>maven-surefire-plugin</artifactId>
8282
<version>3.5.1</version>
83-
<configuration>
84-
<argLine>-javaagent:${settings.localRepository}/net/bytebuddy/byte-buddy-agent/1.15.4/byte-buddy-agent-1.15.4.jar</argLine>
85-
</configuration>
8683
</plugin>
8784
<plugin>
8885
<artifactId>maven-jar-plugin</artifactId>
8986
<version>3.4.1</version>
90-
<configuration>
91-
<archive>
92-
<manifest>
93-
<mainClass>org.example.AppImpl</mainClass>
94-
</manifest>
95-
</archive>
96-
</configuration>
9787
</plugin>
9888
<plugin>
9989
<artifactId>maven-install-plugin</artifactId>
@@ -114,5 +104,46 @@
114104
</plugin>
115105
</plugins>
116106
</pluginManagement>
107+
<plugins>
108+
<plugin>
109+
<groupId>org.apache.maven.plugins</groupId>
110+
<artifactId>maven-surefire-plugin</artifactId>
111+
<configuration>
112+
<argLine>-javaagent:${settings.localRepository}/net/bytebuddy/byte-buddy-agent/1.15.4/byte-buddy-agent-1.15.4.jar</argLine>
113+
</configuration>
114+
</plugin>
115+
<plugin>
116+
<groupId>org.apache.maven.plugins</groupId>
117+
<artifactId>maven-jar-plugin</artifactId>
118+
<configuration>
119+
<archive>
120+
<manifest>
121+
<addClasspath>true</addClasspath>
122+
<classpathPrefix>lib/</classpathPrefix>
123+
<mainClass>org.example.AppImpl</mainClass>
124+
</manifest>
125+
</archive>
126+
</configuration>
127+
</plugin>
128+
<plugin>
129+
<groupId>org.apache.maven.plugins</groupId>
130+
<artifactId>maven-dependency-plugin</artifactId>
131+
<executions>
132+
<execution>
133+
<id>copy-libs</id>
134+
<phase>package</phase>
135+
<goals>
136+
<goal>copy-dependencies</goal>
137+
</goals>
138+
<configuration>
139+
<includeScope>runtime</includeScope>
140+
<overWriteReleases>false</overWriteReleases>
141+
<overWriteSnapshots>true</overWriteSnapshots>
142+
<outputDirectory>${project.build.directory}/lib</outputDirectory>
143+
</configuration>
144+
</execution>
145+
</executions>
146+
</plugin>
147+
</plugins>
117148
</build>
118149
</project>

src/main/java/org/example/processor/ArgumentProcessorImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public ArgumentProcessorImpl(ArgumentValidator argumentValidator, PasswordGenera
2222
public void process(String[] args) {
2323
if (!argumentValidator.validate(args)) {
2424
String usage = "Usage:" + System.lineSeparator() +
25-
"java -jar ./demo-java-cli.jar generate password";
25+
"java -jar ./demo-java-cli-[VERSION].jar generate password";
2626
terminal.show(usage);
2727
return;
2828
}

src/test/java/org/example/processor/ArgumentProcessorImplTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ void checkProcessMethodForGeneratePassword() {
4444
@Test
4545
void checkProcessMethodForInvalidArguments() {
4646
String usage = "Usage:" + System.lineSeparator() +
47-
"java -jar ./demo-java-cli.jar generate password";
47+
"java -jar ./demo-java-cli-[VERSION].jar generate password";
4848

4949
String[] args = new String[]{};
5050
when(argumentValidator.validate(args)).thenReturn(false);

0 commit comments

Comments
 (0)