我在maven上非常糟糕,我得到了MissingResourceException错误:
所以这是我的pom.xml(构建):
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
<addClasspath>true</addClasspath>
<mainClass>org.jis.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.14</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>6.4.1</version>
</dependency>
</dependencies>
<configuration>
<consoleOutput>true</consoleOutput>
<configLocation>${basedir}/src/test/resources/checkstyle_swt1.xml</configLocation>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<descriptor>src/assembly/src.xml</descriptor>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
我的src.xml:
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>src</id>
<includeBaseDirectory>false</includeBaseDirectory>
<formats>
<format>zip</format>
</formats>
<files>
<file>
<source>.gitignore</source>
<destName>gitignore.txt</destName>
</file>
</files>
<fileSets>
<fileSet>
<outputDirectory/>
<includes>
<include>${project.basedir}/src/main/java/org/jis/generator/Consumer.java</include>
<include>${project.basedir}/src/main/java/org/jis/generator/Element.java</include>
<include>${project.basedir}/src/main/java/org/jis/generator/Generator.java</include>
<include>${project.basedir}/src/main/java/org/jis/generator/LayoutGalerie.java</include>
<include>${project.basedir}/src/main/java/org/jis/generator/Producer.java</include>
<include>${project.basedir}/src/main/java/org/jis/generator/TableGalerie.java</include>
<include>${project.basedir}/src/main/java/org/jis/listner/CloseListner.java</include>
<include>${project.basedir}/src/main/java/org/jis/listner/ExitListner.java</include>
<include>${project.basedir}/src/main/java/org/jis/listner/MenuListner.java</include>
<include>${project.basedir}/src/main/java/org/jis/options/Options.java</include>
<include>${project.basedir}/src/main/java/org/jis/view/dialog/AboutBox.java</include>
<include>${project.basedir}/src/main/java/org/jis/view/dialog/GallerieDialog.java</include>
<include>${project.basedir}/src/main/java/org/jis/view/dialog/Layout.java</include>
<include>${project.basedir}/src/main/java/org/jis/view/dialog/OptionsEdit.java</include>
<include>${project.basedir}/src/main/java/org/jis/view/FileTree.java</include>
<include>${project.basedir}/src/main/java/org/jis/view/List.java</include>
<include>${project.basedir}/src/main/java/org/jis/view/Menu.java</include>
<include>${project.basedir}/src/main/java/org/jis/view/Preview.java</include>
<include>${project.basedir}/src/main/java/org/jis/view/Status.java</include>
<include>${project.basedir}/src/main/java/org/jis/view/Thumbnail.java</include>
<include>${project.basedir}/src/main/java/org/jis/view/Toolbar.java</include>
<include>${project.basedir}/src/main/java/org/jis/Main.java</include>
<include>${project.basedir}/src/main/java/org/jis/Messages.java</include>
</includes>
</fileSet>
<fileSet>
<directory>target</directory>
<includes>
<include>pom.xml</include>
</includes>
</fileSet>
<fileSet>
<directory>target</directory>
<includes>
<include>changelog.xml</include>
<include>changelog.html</include>
</includes>
<outputDirectory>docs</outputDirectory>
</fileSet>
</fileSets>
我不确定我在这里做错了什么,但我在this post读到它可能会发生,因为我的属性和类文件在我的jar文件中的相同位置。
但是如何在我的pom.xml中修复此问题?
编辑:
错误消息为文本
Exception in thread "main" java.util.MissingResourceException: Can't find bundle
for base name org.jis.messages, locale en
at java.util.ResourceBundle.throwMissingResourceException(Unknown Source
)
at java.util.ResourceBundle.getBundleImpl(Unknown Source)
at java.util.ResourceBundle.getBundle(Unknown Source)
at org.jis.Messages.<init>(Messages.java:42)
at org.jis.Main.<init>(Main.java:86)
at org.jis.Main.main(Main.java:201)