Closed luis100 closed 9 years ago
Hi Luis I removed the old things with errors and I added the ANT_KOST-Val.xml into the project. Please test the ANT_KOST-Val.xml and let me know if you need more information. Chlara
Still not working, problem is due to all paths being absolute when they should be relative.
$ ant -f ANT_KOST-Val.xml
Buildfile: /home/lfaria/Projects/KOST-Val/ANT_KOST-Val.xml
create_run_jar:
BUILD FAILED
/home/lfaria/Projects/KOST-Val/ANT_KOST-Val.xml:6: /home/lfaria/Projects/KOST-Val/C:/Users/U80809724/GIT/KOST-Val/KOST-Val/target/classes does not exist.
Total time: 0 seconds
Also, the ant script is not compiling the sources but just assembling the final jar.
I don't know how to change this in eclipse, but I changed the absolute paths in relative with the text editor.
I have testet the ANT_KOST-Val.xml and it works for me (Eclipse and Windows).
Buildfile: C:\Users\U80809724\GIT\KOST-Val\ANT_KOST-Val.xml
create_run_jar:
[jar] Building jar: C:\Software\KOST-Val\kostval_de.jar
BUILD SUCCESSFUL
Total time: 14 seconds
Otherwise you can also try to build it manually by exporting the Project as a runnable JAR File with the "ch.kostceco.tools.kostval.KOSTVal" as Main-Class.
What environment (IDE) do you use?
I have added build.xml for compiling the sources
I also use Eclipse as my java IDE, but I am used to have a command-line tool build the program, just like Ant or Maven, as it would help everyone to be able to build the code without having a specific IDE.
Your build.xml works well for me, but has a couple of problems. Firstly it has an encoding problem on my machine, which is solved by this pull request.
But then, the build fails due to this problem:
build-project:
[echo] KOST-Val: /home/lfaria/Projects/KOST-Val/KOST-Val/build.xml
[javac] /home/lfaria/Projects/KOST-Val/KOST-Val/build.xml:102: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 131 source files to /home/lfaria/Projects/KOST-Val/KOST-Val/target/classes
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.6
[javac] /home/lfaria/Projects/KOST-Val/KOST-Val/src/main/java/ch/kostceco/tools/kostval/validation/modulesiard/impl/ValidationFrowModuleImpl.java:234: error: cannot find symbol
[javac] if ( range.min == 0 && range.max == UNBOUNDED ) {
[javac] ^
[javac] symbol: variable min
[javac] location: variable range of type Range
[javac] where Range is a type-variable:
[javac] Range extends Object declared in class ValidationFrowModuleImpl
(...)
@luis100 Thanks for the pull request. I moved the initialization of "range.min" and "range.max" so that maybe it will work now.
I think the problem has to do with the parameterization of the ValidationFrowModuleImpl class with diamond shaped restrictions with the same name of the private inner-classes. Some compilers would not know which class are you referring, the generic class defining on the parametrization, or the private inner-class.
To me, the parameterization doesn't seem to be needed at all, and removing it solves all my problems, check this pull request
Thanks. I didn't know that. I merged the correction manually. See this commit.
Can I close this issue?
Now the master compiles in Linux, but still there is a small problem on the ANT_KOST-Val.xml which refers an absolute path (<jar destfile="C:/Software/KOST-Val/kostval_de.jar">
). Also, the build jar by itself is unable to run as it needs the configuration and resources folder that are not built by the system.
Sorry to be so insistent in automatic building, but for me to be able to contribute to the KOST-Val project, I need to be able to build a running version of it easily.
You are right, that the build jar by itself cant run... That's why i build the jar in C:/Software/KOST-Val/kostval_de.jar (This is my place where the configuration and resources are). :-)
I understand what you want. Can you give my a hint how to change that?
@luis100 I Think maven is the better solution. What is your opinion?
Firstly, I must say that Maven is far better than Ant, and I would prefer it anytime. But for you to go now to Maven it will give you much more work, so it really depends on how much time you want to invest on this. Maven will also allow you to refer to libraries that download themselves during build, so you don't have to ship your libraries as jars together with the code.
But, you can do the whole build by improving the Ant script ANT_KOST-Val.xml
(maybe rename it to the default name build.xml
), adding a task that puts together all configuration, resources and built code into a prepared KOST-Val.zip.
Just copy your default configuration and resources into the sources folder, and create in the Ant script a new target that will call a zip task putting together the compiled jar, and all other needed default folders.
This new target should depend on the building of the code and on the assembly of the all-in-one-jar (target create_run_jar
). You can defined this dependency quite easily, check the documentation.
Also, you could call the other build script from this primary build script using the task antcall.
Finally, you should not commit any generated resource into GitHub, using .gitignore.
If you go with Maven, then you will have to do some of the same process, but instead of using a task you would have to use the maven assembly plugin.
Thanks for the Information. I will think about it.
An other problem is the multilingualism (DE/FR/EN). Actually I build three different jar or make a copy of the kostval_de.jar and rename the included message.properties an rename it in kostval_fr.jar and kostval_en.jar.
On our projects we normally use Java's resource bundle to deal with internationalization, which is not far from what you have done. Then we select the locale by using the user locale, the default configuration also and allow the user to select it via CLI/GUI option.
@luis100 I have made some changes so that running the Makejar.launch will build the 3 jars and the environment like the configuration and resource folder. But I have still one problem in the Makejar.launch :-( I can't change the paths in Makejar.launch in relative (line 10 and 13). Do you know how to change that? After that it could work... Chlara
When trying to build the project on my own machine, I get the following error:
Please fix the problem or provide build instruction on the README.md file.