YES! It works! thank you everyone~ It looks like maven treate"resource" folder for resource file , not only add the folder to build path
On Mon, Jun 3, 2013 at 2:29 PM, Baptiste MATHUS [via Maven] < ml-node+s40175n5758040...@n5.nabble.com> wrote: > +1. That should do the trick. > Eclipse classpath system is unfortunately not finely configurable. You'll > generally be able to do things in eclipse you can't with maven. And this > will be an issue on eclipse side... > > Cheers > Le 3 juin 2013 04:53, "Russell Gold" <[hidden > email]<http://user/SendEmail.jtp?type=node&node=5758040&i=0>> > a écrit : > > > Hi Jade, > > > > Could you please try placing the fpt.properties file at the root of > > src/main/resources? That's the convention in Maven for resources that > you > > want copied int the jar. > > > > Regards, > > Russ > > > > On Jun 2, 2013, at 10:27 PM, Jade <[hidden > > email]<http://user/SendEmail.jtp?type=node&node=5758040&i=1>> > wrote: > > > > > Hi Russell: > > > > > > I put the file "fpt.properties" in the root of java source code > foler > > > "src/main/java". And I load the file with ResourceBundle: > > > > > > <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< > > > ResourceBundle resourceBundle = ResourceBundle.getBundle("ftp"); > > > String host= resourceBundle.getString("host"); > > >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> > > > > > > Java Doc says ResourceBundle will looking for the file > > > "ftp_en_US.properties" for my system local is "en_US". If it can not > file > > > the file "ftp_en_US.properties", ResourceBundle will load the file > > > "ftp.properties" as default. > > > > > > Now the problem is : > > > > > > If my project was compile byEclipse, it's all OK when I run the test > > > case both in Eclipe or run the test case by command "mvn test". > > > > > > But if the project was compile by maven (I mean I run "mvn clean"), > the > > > test case will fail with the exception "Can't find bundle". > > > > > > I think the class file compile by maven will not load > "fpt.properties" > > > as default when it can not file the file "ftp_en_US.properties" > > > > > > > > > On Mon, Jun 3, 2013 at 2:19 AM, Russell Gold [via Maven] < > > > [hidden email] <http://user/SendEmail.jtp?type=node&node=5758040&i=2>> > wrote: > > > > > >> Hi Jade, > > >> > > >> Where are you placing the ftp.properties file and how does your > program > > >> attempt to find it? > > >> > > >> - Russ > > >> > > >> On Jun 2, 2013, at 12:07 AM, Jade <[hidden email]< > > http://user/SendEmail.jtp?type=node&node=5757956&i=0>> > > >> wrote: > > >> > > >>> Hello everyone : > > >>> > > >>> I'm a beginner of maven. > > >>> > > >>> In my project, I have an file "ftp.proterties" only use for ftp > > >> config, > > >>> not for I18N useage. This file's > > >>> Content like : > > >>> > > >>>>>>>>>>>>>>>>>>>>>>>>>>>>> > > >>> host=192.168.1.105 > > >>> port=21 > > >>> username=jade > > >>> password=p@55w0rd > > >>> <<<<<<<<<<<<<<<<<<<<<<<<<< > > >>> > > >>> When I run the JUnit test in Eclipse, Everything is OK. But when I > > >> run > > >>> the TestCase with "mvn test" > > >>> I get an exception: > > >>> > > >>>>>>>>>>>>>>>>>>>>>>>>>>>>> > > >>> Tests in error: > > >>> test(jadeutils.ftp.FtpServiceTest): Can't find bundle for base name > > >> ftp, > > >>> locale en_US > > >>> <<<<<<<<<<<<<<<<<<<<<<<<<< > > >>> > > >>> > > >>> > > >>> -- > > >>> View this message in context: > > >> > > > http://maven.40175.n5.nabble.com/MessageBundle-problem-for-using-maven-test-tp5757876.html > > >>> Sent from the Maven - Users mailing list archive at Nabble.com. > > >>> > > >>> > --------------------------------------------------------------------- > > >>> To unsubscribe, e-mail: [hidden email]< > > http://user/SendEmail.jtp?type=node&node=5757956&i=1> > > >>> For additional commands, e-mail: [hidden email]< > > http://user/SendEmail.jtp?type=node&node=5757956&i=2> > > >>> > > >> > > >> ----------------- > > >> Come read my webnovel, Take a Lemon <http://www.takealemon.com>, > > >> and listen to the Misfile radio play < > > >> http://www.gold-family.us/audio/misfile.html>! > > >> > > >> > > >> > > >> > > >> > > >> > > >> ------------------------------ > > >> If you reply to this email, your message will be added to the > discussion > > >> below: > > >> > > >> > > > http://maven.40175.n5.nabble.com/MessageBundle-problem-for-using-maven-test-tp5757876p5757956.html > > >> To unsubscribe from MessageBundle problem for using maven test, click > > >> here< > > > > > >> . > > >> NAML< > > > http://maven.40175.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml > > > > > >> > > > > > > > > > > > > > > > -- > > > View this message in context: > > > http://maven.40175.n5.nabble.com/MessageBundle-problem-for-using-maven-test-tp5757876p5758036.html > > > Sent from the Maven - Users mailing list archive at Nabble.com. > > > > ----------------- > > Come read my webnovel, Take a Lemon <http://www.takealemon.com>, > > and listen to the Misfile radio play < > > http://www.gold-family.us/audio/misfile.html>! > > > > > > > > > > > > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > > http://maven.40175.n5.nabble.com/MessageBundle-problem-for-using-maven-test-tp5757876p5758040.html > To unsubscribe from MessageBundle problem for using maven test, click > here<http://maven.40175.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5757876&code=ZXZva2VyYWx1Y2FyZEBnbWFpbC5jb218NTc1Nzg3NnwtMTc3OTU4MDg4NQ==> > . > NAML<http://maven.40175.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> > -- View this message in context: http://maven.40175.n5.nabble.com/MessageBundle-problem-for-using-maven-test-tp5757876p5758197.html Sent from the Maven - Users mailing list archive at Nabble.com.