Maven #02 ~ pom.xml

pom.xml is the main element of our project. In file are defined all of the dependencies for example:

  • a way of building a project
  • testing
  • running a project
  • generating documentation
  • creating a release

 

After generating project pom.xml file looks as follows:

It looks very raw. Only groupId, artifactId, modelVersion, version. This information on this step is not very important for us. First, change that we will make will be adding JUnit library.

Now we can compile our project:

As we can see project build successfully. For now, we should look at three commands:

  • mvn  – this command runs maven and proper pom.xml file
  • clean – delete target catalog and old files version
  • compile – runs java compiler

aapt on OS X

During launching my tests written in JUnit I notice problem with performing one of them. I received:

java.io.IOException: Cannot run program "aapt": error=20, Not a directory at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)

In Stack Overflow I found a lot of solutions but non of them didn’t solve my problem. There’s a bug in IntelliJ IDE that points to platform-tools for executable that are in build-tools. I found my own solutions of this problem:

ln -s 23.0.2 build-tools/current
ln -s ../build-tools/current/aapt platform-tools/aapt
ln -s ../build-tools/current/lib platform-tools/lib

This solution works for me. Similar problem appears in Windows and Linux.