Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 98 additions & 27 deletions javafx-fxml-example/pom.xml
Original file line number Diff line number Diff line change
@@ -1,29 +1,46 @@
<?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">
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>

<!-- 父项目信息 -->
<parent>
<groupId>io.github.kennethfan</groupId>
<artifactId>study</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<!-- 项目基本信息 -->
<artifactId>javafx-fxml-example</artifactId>
<packaging>jar</packaging>

<name>JavaFX FXML Example</name>
<description>A JavaFX application example using FXML for UI design</description>

<!-- 属性配置 -->
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<javafx.version>17</javafx.version>
<main.class>io.github.kennethfan.MainApp</main.class>
<maven-assembly-plugin.version>3.6.0</maven-assembly-plugin.version>
<javafx-maven-plugin.version>0.0.8</javafx-maven-plugin.version>
</properties>

<!-- 依赖管理 -->
<dependencies>
<!-- 内部依赖 -->
<dependency>
<groupId>io.github.kennethfan</groupId>
<artifactId>common-util</artifactId>
</dependency>

<!-- JavaFX 依赖 -->
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
Expand All @@ -34,42 +51,96 @@
<artifactId>javafx-fxml</artifactId>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>${javafx.version}</version>
</dependency>
</dependencies>

<!-- 构建配置 -->
<build>
<plugins>
<!-- 编译器插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>

<!-- 打包插件 - 创建可执行jar -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>${maven-assembly-plugin.version}</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>${main.class}</mainClass>
<addClasspath>true</addClasspath>
</manifest>
</archive>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>

<!-- JavaFX Maven 插件 -->
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.8</version>
<version>${javafx-maven-plugin.version}</version>
<configuration>
<mainClass>${main.class}</mainClass>
<!-- <executable>$JAVA_HOME/bin/java</executable>-->
<options>
<option>--module-path</option>
<option>${project.build.directory}/classpath</option>
<option>--add-modules</option>
<option>javafx.controls,javafx.fxml</option>
</options>
</configuration>
</plugin>

<!-- 资源处理插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.1</version>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>jpackage</id>
<build>
<plugins>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.8</version>
<configuration>
<mainClass>${main.class}</mainClass>
<jlinkZipName>${project.artifactId}</jlinkZipName>
<jlinkImageName>${project.artifactId}</jlinkImageName>
<launcher>${project.artifactId}</launcher>
<noManPages>true</noManPages>
<stripDebug>true</stripDebug>
<noHeaderFiles>true</noHeaderFiles>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
<!-- 资源目录配置 -->
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
<include>**/*.fxml</include>
<include>**/*.css</include>
</includes>
</resource>
</resources>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
package io.github.kennethfan.model;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

@Setter
@Getter
@AllArgsConstructor
public class User {

private String username;

private String password;

public User(String username, String password) {
this.username = username;
this.password = password;
}

public String getUsername() {
return username;
}

public User setUsername(String username) {
this.username = username;
return this;
}

public String getPassword() {
return password;
}

public User setPassword(String password) {
this.password = password;
return this;
}
}
Loading