gpt4 book ai didi

java - 带有 maven jetty 插件的 applcation.properties

转载 作者:太空宇宙 更新时间:2023-11-03 14:02:32 24 4
gpt4 key购买 nike

我尝试将 maven jetty 插件配置为在 8443 (TLS) 端口上运行。
我读了很多关于包括官方文档的东西。
这个手册https://www.eclipse.org/jetty/documentation/9.4.x/jetty-maven-plugin.html#configuring-security-settings建议用XML文件来配置它,但是我没有成功在那里配置keystore的路径。
所以我从这里继续 application.properties 方式 https://drissamri.be/blog/java/enable-https-in-spring-boot/
问题是 jetty 无法识别 application.properties
当我启动应用程序时,8443 端口是空闲的。

这是application.properties:

server.port = 8445
server.ssl.key-store = classpath:keystore.jks
server.ssl.key-store-password = 123456
server.ssl.key-password = 123456

这是 mvn jetty:run 的输出:

[INFO] Scanning elapsed time=653ms
[INFO] 2 Spring WebApplicationInitializers detected on classpath
18:20:56.634 [main] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding PropertySource 'servletConfigInitParams' with lowest search precedence
18:20:56.637 [main] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding PropertySource 'servletContextInitParams' with lowest search precedence
18:20:56.640 [main] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding PropertySource 'jndiProperties' with lowest search precedence
18:20:56.640 [main] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding PropertySource 'systemProperties' with lowest search precedence
18:20:56.640 [main] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding PropertySource 'systemEnvironment' with lowest search precedence
18:20:56.641 [main] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Initialized StandardServletEnvironment with PropertySources [StubPropertySource@760604710 {name='servletConfigInitParams', properties=java.lang.Object@4d1ff6b1}, StubPropertySource@1173837542 {name='servletContextInitParams', properties=java.lang.Object@329548d0}, JndiPropertySource@805536380 {name='jndiProperties', properties=org.springframework.jndi.JndiLocatorDelegate@29b40b3}, MapPropertySource@2099541600 {name='systemProperties', properties={java.runtime.name=Java(TM) SE Runtime Environment, sun.boot.library.path=/usr/local/java/jdk1.8.0_121/jre/lib/amd64, java.vm.version=25.121-b13, maven.multiModuleProjectDirectory=/home/opshenichnikova/NetBeansProjects/bot-integrity, java.vm.vendor=Oracle Corporation, java.vendor.url=http://java.oracle.com/, guice.disable.misplaced.annotation.check=true, path.separator=:, java.vm.name=Java HotSpot(TM) 64-Bit Server VM, file.encoding.pkg=sun.io, user.country=US, sun.java.launcher=SUN_STANDARD, sun.os.patch.level=unknown, java.vm.specification.name=Java Virtual Machine Specification, user.dir=/home/opshenichnikova/NetBeansProjects/bot-integrity, java.runtime.version=1.8.0_121-b13, java.awt.graphicsenv=sun.awt.X11GraphicsEnvironment, java.endorsed.dirs=/usr/local/java/jdk1.8.0_121/jre/lib/endorsed, os.arch=amd64, java.io.tmpdir=/tmp, line.separator=
, java.vm.specification.vendor=Oracle Corporation, os.name=Linux, classworlds.conf=/usr/share/maven/bin/m2.conf, sun.jnu.encoding=UTF-8, jetty.git.hash=82b8fb23f757335bb3329d540ce37a2a2615f0a8, java.library.path=/opt/oracle/instantclient:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib, java.specification.name=Java Platform API Specification, java.class.version=52.0, sun.management.compiler=HotSpot 64-Bit Tiered Compilers, os.version=4.4.0-119-generic, user.home=/home/opshenichnikova, user.timezone=Europe/Moscow, java.awt.printerjob=sun.print.PSPrinterJob, file.encoding=UTF-8, java.specification.version=1.8, java.class.path=/usr/share/maven/boot/plexus-classworlds-2.x.jar, user.name=opshenichnikova, java.vm.specification.version=1.8, sun.java.command=org.codehaus.plexus.classworlds.launcher.Launcher -e jetty:run, java.home=/usr/local/java/jdk1.8.0_121/jre, sun.arch.data.model=64, user.language=en, java.specification.vendor=Oracle Corporation, awt.toolkit=sun.awt.X11.XToolkit, java.vm.info=mixed mode, java.version=1.8.0_121, securerandom.source=file:/dev/./urandom, java.ext.dirs=/usr/local/java/jdk1.8.0_121/jre/lib/ext:/usr/java/packages/lib/ext, sun.boot.class.path=/usr/local/java/jdk1.8.0_121/jre/lib/resources.jar:/usr/local/java/jdk1.8.0_121/jre/lib/rt.jar:/usr/local/java/jdk1.8.0_121/jre/lib/sunrsasign.jar:/usr/local/java/jdk1.8.0_121/jre/lib/jsse.jar:/usr/local/java/jdk1.8.0_121/jre/lib/jce.jar:/usr/local/java/jdk1.8.0_121/jre/lib/charsets.jar:/usr/local/java/jdk1.8.0_121/jre/lib/jfr.jar:/usr/local/java/jdk1.8.0_121/jre/classes, java.vendor=Oracle Corporation, maven.home=/usr/share/maven, file.separator=/, java.vendor.url.bug=http://bugreport.sun.com/bugreport/, sun.io.unicode.encoding=UnicodeLittle, sun.cpu.endian=little, sun.desktop=gnome, sun.cpu.isalist=}}, SystemEnvironmentPropertySource@1701798620 {name='systemEnvironment', properties={PATH=/opt/oracle/instantclient:/home/opshenichnikova/bin:/home/opshenichnikova/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-9-oracle/bin:/usr/lib/jvm/java-9-oracle/db/bin:/usr/local/java/jdk1.8.0_121//bin:/usr/local/java/jdk1.8.0_121//bin:/opt/proclog/:/opt/cprocsp/bin/amd64/:/opt/cprocsp/sbin/amd64/:/opt/proclog, XAUTHORITY=/home/opshenichnikova/.Xauthority, XMODIFIERS=@im=ibus, XDG_DATA_DIRS=/usr/share/ubuntu:/usr/share/gnome:/usr/local/share:/usr/share:/var/lib/snapd/desktop:/var/lib/snapd/desktop, GDMSESSION=ubuntu, MANDATORY_PATH=/usr/share/gconf/ubuntu.mandatory.path, GTK_IM_MODULE=ibus, TNS_ADMIN=/etc, DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-EWkFlV90x8, DEFAULTS_PATH=/usr/share/gconf/ubuntu.default.path, XDG_CURRENT_DESKTOP=Unity, JRE_HOME=/usr/local/java/jdk1.8.0_121/, LD_LIBRARY_PATH=/opt/oracle/instantclient, UPSTART_SESSION=unix:abstract=/com/ubuntu/upstart-session/1001/2482, QT4_IM_MODULE=xim, SESSION_MANAGER=local/IAS-WS-UX02:@/tmp/.ICE-unix/2735,unix/IAS-WS-UX02:/tmp/.ICE-unix/2735, QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1, LOGNAME=opshenichnikova, JOB=unity-settings-daemon, PWD=/home/opshenichnikova/NetBeansProjects/bot-integrity, DERBY_HOME=/usr/lib/jvm/java-9-oracle/db, IM_CONFIG_PHASE=1, LANGUAGE=en_US, WINDOWID=54525962, SHELL=/bin/bash, LESSOPEN=| /usr/bin/lesspipe %s, UNITY_HAS_3D_SUPPORT=true, GTK2_MODULES=overlay-scrollbar, INSTANCE=, J2SDKDIR=/usr/lib/jvm/java-9-oracle, GOPATH=/home/opshenichnikova/go:/home/opshenichnikova/NetBeansProjects/islps/core/goLibs, OLDPWD=/home/opshenichnikova/NetBeansProjects/bot-integrity, GNOME_DESKTOP_SESSION_ID=this-is-deprecated, UPSTART_INSTANCE=, GTK_MODULES=gail:atk-bridge:unity-gtk-module, J2REDIR=/usr/lib/jvm/java-9-oracle, CLUTTER_IM_MODULE=xim, XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0, COMPIZ_BIN_PATH=/usr/bin/, SESSIONTYPE=gnome-session, XDG_SESSION_DESKTOP=ubuntu, LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:, SHLVL=1, LESSCLOSE=/usr/bin/lesspipe %s %s, COMPIZ_CONFIG_PROFILE=ubuntu, QT_IM_MODULE=ibus, UPSTART_JOB=unity7, JAVA_HOME=/usr/local/java/jdk1.8.0_121/, TERM=xterm-256color, XFILESEARCHPATH=/usr/dt/app-defaults/%L/Dt, XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/usr/share/upstart/xdg:/etc/xdg, LANG=en_US.UTF-8, GNOME_KEYRING_CONTROL=, XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0, XDG_SESSION_ID=c2, XDG_SESSION_TYPE=x11, DISPLAY=:0, UNITY_DEFAULT_PROFILE=unity, ORACLE_HOME=/opt/oracle/instantclient, NODE_PATH=/usr/lib/nodejs:/usr/lib/node_modules:/usr/share/javascript, MAVEN_CMD_LINE_ARGS= -e jetty:run, _=/usr/bin/mvn, GDM_LANG=en_US, XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/opshenichnikova, UPSTART_EVENTS=xsession started, GPG_AGENT_INFO=/home/opshenichnikova/.gnupg/S.gpg-agent:0:1, MAVEN_PROJECTBASEDIR=/home/opshenichnikova/NetBeansProjects/bot-integrity, DESKTOP_SESSION=ubuntu, SESSION=ubuntu, USER=opshenichnikova, XDG_MENU_PREFIX=gnome-, VTE_VERSION=4205, QT_ACCESSIBILITY=1, SSH_AUTH_SOCK=/run/user/1001/keyring/ssh, XDG_SEAT=seat0, NLSPATH=/opt/cprocsp/share/locale/%L/LC_MESSAGES/%N:/usr/dt/lib/nls/msg/%L/%N.cat, QT_QPA_PLATFORMTHEME=appmenu-qt5, XDG_VTNR=7, XDG_RUNTIME_DIR=/run/user/1001, HOME=/home/opshenichnikova, GNOME_KEYRING_PID=}}]
18:20:56.643 [main] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Replacing PropertySource 'servletContextInitParams' with 'servletContextInitParams'

. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.0.0.RELEASE)

2018-04-09 18:20:57.058 INFO 17478 --- [ main] ru.ias.Main : Starting Main on IAS-WS-UX02 with PID 17478 (/home/opshenichnikova/NetBeansProjects/bot-integrity/target/classes started by opshenichnikova in /home/opshenichnikova/NetBeansProjects/bot-integrity)
2018-04-09 18:20:57.060 INFO 17478 --- [ main] ru.ias.Main : No active profile set, falling back to default profiles: default
2018-04-09 18:20:57.113 INFO 17478 --- [ main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@1860f3be: startup date [Mon Apr 09 18:20:57 MSK 2018]; root of context hierarchy
2018-04-09 18:20:57.855 INFO 17478 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
[INFO] Initializing Spring embedded WebApplicationContext
2018-04-09 18:20:57.938 INFO 17478 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 828 ms
2018-04-09 18:20:58.189 INFO 17478 --- [ main] o.s.b.w.servlet.ServletRegistrationBean : Servlet dispatcherServlet mapped to [/]
2018-04-09 18:20:58.192 INFO 17478 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2018-04-09 18:20:58.192 INFO 17478 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'errorPageFilter' to: [/*]
2018-04-09 18:20:58.192 INFO 17478 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2018-04-09 18:20:58.192 INFO 17478 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2018-04-09 18:20:58.192 INFO 17478 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2018-04-09 18:20:58.525 INFO 17478 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@1860f3be: startup date [Mon Apr 09 18:20:57 MSK 2018]; root of context hierarchy
2018-04-09 18:20:58.604 INFO 17478 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/admin/account/list],methods=[GET]}" onto public java.util.List<ru.ias.orm.Account> ru.ias.controllers.admin.AdminController.getAccounts()
2018-04-09 18:20:58.606 INFO 17478 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/admin/invoices],methods=[GET]}" onto public java.util.List<ru.ias.orm.Invoice> ru.ias.controllers.admin.InvoiceController.getInvoices(javax.servlet.http.HttpServletResponse)
2018-04-09 18:20:58.609 INFO 17478 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-04-09 18:20:58.610 INFO 17478 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2018-04-09 18:20:58.651 INFO 17478 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-04-09 18:20:58.651 INFO 17478 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-04-09 18:20:58.699 INFO 17478 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-04-09 18:20:58.900 INFO 17478 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-04-09 18:20:58.916 INFO 17478 --- [ main] ru.ias.Main : Started Main in 2.266 seconds (JVM running for 5.815)
[INFO] DefaultSessionIdManager workerName=node0
[INFO] No SessionScavenger set, using defaults
[INFO] Scavenging every 660000ms
[INFO] Initializing Spring FrameworkServlet 'dispatcherServlet'
2018-04-09 18:20:58.983 INFO 17478 --- [ main] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization started
2018-04-09 18:20:58.998 INFO 17478 --- [ main] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization completed in 15 ms
[INFO] Started o.e.j.m.p.JettyWebAppContext@165e389b{/,file:///home/opshenichnikova/NetBeansProjects/bot-integrity/target/webapp-tmp/,AVAILABLE}{file:///home/opshenichnikova/NetBeansProjects/bot-integrity/target/webapp-tmp/}
[INFO] Jetty server exiting.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.005 s
[INFO] Finished at: 2018-04-09T18:20:59+03:00
[INFO] Final Memory: 42M/669M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.eclipse.jetty:jetty-maven-plugin:9.4.8.v20171121:run (default-cli) on project bot-integrity: Failure: Address already in use -> [Help 1]

应用程序的结构是:

├── pom.xml
├── src
│   ├── main
│   │   ├── java
│   │   │   └── ru
│   │   │   └── ias
│   │   │   └── Main.java
│   │   └── resources
│   │   ├── application.properties

pom 是:

<?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>ru.ias</groupId>
<artifactId>bot-integrity</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>

<name>bot-integrity</name>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.RELEASE</version>
</parent>

<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots</artifactId>
<version>3.6</version>
<exclusions>
<exclusion>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>3.1.3</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
</dependency>
<!--<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency>-->
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<version>1.1</version>
</dependency>
<!--<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot</artifactId>
<type>jar</type>
</dependency>
<!--<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
<type>jar</type>
</dependency>-->
</dependencies>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.8.v20171121</version>
<configuration>
<!--jettyXml>jetty.xml,jetty-ssl.xml,jetty-https.xml</jettyXml>-->
<webAppConfig>
<allowDuplicateFragmentNames>
true
</allowDuplicateFragmentNames>
</webAppConfig>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<warName>botintegrity</warName>
</configuration>
</plugin>
</plugins>
</build>

<repositories>
<!--<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>-->
<repository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<!--<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>-->
</repositories>
<pluginRepositories>
<pluginRepository>
<id>repository.spring.release</id>
<name>Spring GA Repository</name>
<url>https://repo.spring.io/plugins-release/</url>
</pluginRepository>
</pluginRepositories>

</project>

最佳答案

你检查过你打包后的jar包里是否有你需要的资源吗?检查 target/classes 目录。如果是这样,那么 jetty-plugin 配置显然有问题。

据我所知,为了捆绑资源,您必须使用 Maven 资源插件并声明这些资源。这是 link to documentation .

用法很简单

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/application.properties</include>
</includes>
</resource>
</resources>
</build>

希望对你有帮助。

关于java - 带有 maven jetty 插件的 applcation.properties,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49736945/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com