Tag Archives: maven

MAVEN_OPTS

how to set MAVEN_OPTS:

export MAVEN_OPTS=”-Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m”

webservices contract-first and contract sharing

The webservices contract-first is, i think, a good concept. But how it actually should be executed is really complicated…

in my opinion it is writing the wsdl by hand and then generate the server and clients form it. So the contract is clear. On the otherhand it is also possible to write the server stubs (in eg. java) first, and then generate the wsdl out of it and define this as contract first. The big benefit of the second method is, that noone needs to be able to write the dm wsdl xmls… but is this really contract first?

The big other issue on webservice is the sharing of the wsdl itself… if you have a handwritten wsdl it is easy to share it… but where? But remember the generated server and its generated new wsdl does not need to be exactly the same…

at work we have a seperate service-contract maven project, which puts the wsdl on a seperate server on install. the idea then is then to get the wsdl with cxf and generate the server and clients. Good idea, nobody uses it 🙁

So a different solution should be found…

checkstyle and pmd

first of all i think checkstyle and pmd are 2 really cool tools, which can improve java source code… but its kinda hard to fulfill them…

or lets say… an old project is really hard… mainly it should be easy, but due to svn and history reasons, an automated refactoring is crap!

but lets do just the important and simple things:

<plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-checkstyle-plugin</artifactId>
       <configuration>
              <configLocation>[remote file]</configLocation>
       </configuration>
</plugin>
<plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-pmd-plugin</artifactId>
       <version>2.5</version>
 </plugin>

run checkstyle

mvn checkstyle:check

run pmd

mvn pmd:pmd

and with hudson is really cool 🙂

svn and eclipse… and maven

ok one of the problems of eclipse with svn is that no eclipse specific file should be commited to the repository… mainly because they are developers computer specific and kinda crap on others computers… additionally not every one uses eclipse… so that the hell should he be doing with the eclipse files? so goal is to delete and ignore them… simple… but now every body needs to set his project localy correctly…

with maven it is actually a bit more confusing… which folders to add? how to add the Maven Dependencies?

Right Click the Project -> Maven -> Update Project Configuration

Done 🙂

maven create eclipse

Just enter following command:

mvn archetype:create -DgroupId=com.test -DartifactId=mytest

The project will be created… to add it to eclipse it is important to run this command:

mvn eclipse:eclipse

now it can be imported to eclipse

m2e

m2e is a really cool plugin for eclipse to run maven commands… i think it is mandatory for developing maven project with eclipse… and normally the installation is easy… but due to missing requirements i got really pissed and have still didnt figured it out…

but today is a good day… http://dev.eclipse.org/mhonarc/lists/m2e-users/msg01880.html

eclipselink with spring

we decided to use jpa with eclipselink… i actually think this was a good decition, but there are a few problems, when using it with spring… eclipselink needs a LoadTimeWeaver… which can only be loaded by spring, when run with an spring agent… add following argumentline to the VM arguments when run…

-javaagent:${where.ever.it.is}/spring-agent-2.5.6.jar

so unit test need this command… the question, how it will work with maven is completely different… and with mule its an other story…

dependencies and repositories in maven

ok actually i didnt get the idea of dependencies and repositories in maven… it just worked… but know i do 🙂

instead of downloading and installing different jar files on your local maschine and on every other server, just tell maven to do it. with dipendencies maven knows which jars it should get and with repositories maven know where to get them… actually the mechanism stores an local copy of the jars in a local repository, and tries first to get it from there… and because of en unique jar version number, updating to new packages in the local repository is maven pom.xml driven.

with this mechanism it is really easy to guarantee the runability of an project… hmm… and when does maven install complete servers?

wsdl and maven

just created a contract-first wsdl… and actually its my first 😛 and yeah… there might be some errors… but those will be fixed at the end of the project… next year… 🙂

i created it in the frontend-clicky-thing of eclipse… kinda simple, but a bit random, how the wsdl will look like… lets just say, i hope for the best…

next task was to generate the java artifacts out of the wsdl file… with maven… and google really helped me: link

<plugin>
    <groupId>org.apache.cxf</groupId>
   <artifactId>cxf-codegen-plugin</artifactId>
   <version>${cxf.version}</version>
   <executions>
      <execution>
         <id>generate-sources</id>
         <phase>generate-sources</phase>
         <configuration>
            <sourceRoot>${project.build.directory}/generated/cxf</sourceRoot>
            <wsdlOptions>
               <wsdlOption>
                  <wsdl>${basedir}/src/main/wsdl/myService.wsdl</wsdl>
               </wsdlOption>
            </wsdlOptions>
         </configuration>
         <goals>
            <goal>wsdl2java</goal>
         </goals>
      </execution>
   </executions>
</plugin>
is the plugin to generate the artifacts… but i m not so sure, that they really are and if they are really usable… but as i sead before… project end next year… enought of time to figure it out 🙂

Eclipse is running in a JRE, but a JDK is required

this bug sucks… and its funny, because i get it from time to time… solution is kinda easy…

add following link in eclipse.ini

-vm
C:\java\jdk\bin\javaw.exe

before

-vmargs