Не читается файл типа properties внутри jar
maven pop.xml
<?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>org.example</groupId>
<artifactId>akus</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.4.0</version>
<configuration>
<archive>
<manifest>
<mainClass>Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
</project>
структура проекта
progect
>.idea
>out
>src
>>main
>java
Main
myPropery.properties
>resources
>>test
>target
класс Main
import java.io.*;
import java.util.Properties;
public class Main {
public static void main(String[] args) throws IOException {
String properdy_address = "src/main/java/myProperty.properties";
Properties myProperty = new Properties();
File file = new File(properdy_address);
InputStream inputStream = new FileInputStream(file);
myProperty.load(inputStream);
System.out.println(myProperty.getProperty("user1"));
System.out.println(myProperty.getProperty("user2"));
System.out.println(myProperty.getProperty("user3"));
}
}
