Solution: Check %USERPROFILE%/.m2/settings.xml file position
My boss went in my office and said "Ok Scuffia, your time has come! With the mighty power of the holy Apache Ant you will package your application, no matter how nor why, but I want a spelled Ant script that builds all your application need to run!" .
First of all my application is composed by:- a Core (a simple Java Library with about 30 classes) that uses 4 other libraries (mainly XML Parsers, loggers, DB accessors)
- A portal container (Jetspeed-2)
- At the moment only one portlet (used to access data)
- A servlet that is an interface between the Core and the Portlet
- A web service (using Axis 1.x) that exports Core methods (in practice the same functionality as the servlet)
There were no problems to rule Ant scripts as to build the Core library (with all depencencies and all needed configuration files, like .properties files); as my application need to be held in one folder, I decided to put together Ant and all source folders.
I also decided to use Maven to build Jetspeed-2 and all portlets, bacause all installation scripts were already done (building, linking, db creating, and resource copying); Maven uses a local repository, in wich it stores downloaded libraries (from servers whose URL are in the configuration file); as my boss needs a completly "offline" installation, all libraries are supposed to be fully downloaded and ready to be linked. Obiously Maven has its configuration file (under ./mavenFolder/conf/settings.xml) in wich you can set the path to the repository: moreover you can choose a configuration different for each user of your OS (Win XP in my case), putting each configuration file inside %USERPROFILE%/.m2/, wich "overwrites" general settings.
Building the portal was as simple as writing:I also decided to use Maven to build Jetspeed-2 and all portlets, bacause all installation scripts were already done (building, linking, db creating, and resource copying); Maven uses a local repository, in wich it stores downloaded libraries (from servers whose URL are in the configuration file); as my boss needs a completly "offline" installation, all libraries are supposed to be fully downloaded and ready to be linked. Obiously Maven has its configuration file (under ./mavenFolder/conf/settings.xml) in wich you can set the path to the repository: moreover you can choose a configuration different for each user of your OS (Win XP in my case), putting each configuration file inside %USERPROFILE%/.m2/, wich "overwrites" general settings.
mvn -P tomcat,min
that stated to build the portal with the underneath web server Tomcat, with just the portal itself and only the administrative portlets (that help administrator to manage users and portlets).
I was so happy that I knew all to do, that I thought to end the work in just 1 working day (inlcuding neverending breaks!)...but It was not so simple!
Each time I tried to build, I got the same error:
D:\GAPWORKSPACE\jetspeed-portal\gapportal\
etc\build.xml:502: java.lang.ClassCast Exception:
org.apache.maven.usability.MojoExecutionExceptionDiagnoser
cannot be cast to
org.apache.maven.usability.diagnostics.ErrorDiagnoser
It lasted for about 3 working days, with my powerlessness: I followed all errors, trying to change code, reading each Maven building script (O.O), when I saw that, as I was using only ./mavenFolder/conf/settings.xml file because I wanted to have the whole stuff inside the same directory and no other file elsewhere, Maven tried to use anyway %USERPROFILE%/.m2/ directory and, only for some libraries, were looking for them in %USERPROFILE%/.m2/repository/, in wich actually there was nothing...
THIS TOOK ME 3 FUCKING DAYS!!!!!
So, although it is not so nice, I decided to have a copy of settings.xml in the user directory, so maven always knows where the repoository is.
And that's the end of my asshole tragedy.
I was so happy that I knew all to do, that I thought to end the work in just 1 working day (inlcuding neverending breaks!)...but It was not so simple!
Each time I tried to build, I got the same error:
D:\GAPWORKSPACE\jetspeed-portal\gapportal\
etc\build.xml:502: java.lang.ClassCast Exception:
org.apache.maven.usability.MojoExecutionExceptionDiagnoser
cannot be cast to
org.apache.maven.usability.diagnostics.ErrorDiagnoser
It lasted for about 3 working days, with my powerlessness: I followed all errors, trying to change code, reading each Maven building script (O.O), when I saw that, as I was using only ./mavenFolder/conf/settings.xml file because I wanted to have the whole stuff inside the same directory and no other file elsewhere, Maven tried to use anyway %USERPROFILE%/.m2/ directory and, only for some libraries, were looking for them in %USERPROFILE%/.m2/repository/, in wich actually there was nothing...
THIS TOOK ME 3 FUCKING DAYS!!!!!
So, although it is not so nice, I decided to have a copy of settings.xml in the user directory, so maven always knows where the repoository is.
And that's the end of my asshole tragedy.
