This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Maven Assembling the Project during the 'mvn install' phase

 
Andrew Jerpe
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.

I am currently learning the specifics of how Maven creates a project that is a simple Web App. In the 'install' plug-in, which executes when I enter "mvn install" from the command line, I see that the WAR file for my web app has indeed been placed in my local repository. However, the assembly operation seems to be also copying the directory structure of my project, ( from <basedir> on down....) into the "target" folder . I am wondering if this is normal. According to the output, the assembling operation is using the 'target' folder to assemble all of the contents before it can be archived, and I understand that....

the command-line output looks like this:
--------------------------------------------------------

C:\MavenApps>cd simple-webapp

C:\MavenApps\simple-webapp>mvn install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building simple-webapp 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ simple-webapp ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\MavenApps\simple-webapp\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.0.2:compile (default-compile) @ simple-webapp ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ simple-webapp ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\MavenApps\simple-webapp\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.0.2:testCompile (default-testCompile) @ simple-webapp ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) @ simple-webapp ---
[INFO] No tests to run.
[INFO] Surefire report directory: C:\MavenApps\simple-webapp\target\surefire-reports

-------------------------------------------------------
T E S T S
-------------------------------------------------------

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[INFO]
[INFO] --- maven-war-plugin:2.1.1:war (default-war) @ simple-webapp ---
[INFO] Packaging webapp
[INFO] Assembling webapp [simple-webapp] in [C:\MavenApps\simple-webapp\target\simple-webapp]
[INFO] Processing war project
[INFO] Copying webapp resources [C:\MavenApps\simple-webapp\src\main\webapp]
[INFO] Webapp assembled in [140 msecs]
[INFO] Building war: C:\MavenApps\simple-webapp\target\simple-webapp.war
[WARNING] Warning: selected war files include a WEB-INF/web.xml which will be ignored
(webxml attribute is missing from war task, or ignoreWebxml attribute is specified as 'true')
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ simple-webapp ---
[INFO] Installing C:\MavenApps\simple-webapp\target\simple-webapp.war to C:\Users\Andrew\.m2\repository\org\sonatype\mavenbook\simpleweb\simple-webapp
\1.0-SNAPSHOT\simple-webapp-1.0-SNAPSHOT.war
[INFO] Installing C:\MavenApps\simple-webapp\pom.xml to C:\Users\Andrew\.m2\repository\org\sonatype\mavenbook\simpleweb\simple-webapp\1.0-SNAPSHOT\sim
ple-webapp-1.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.538s
[INFO] Finished at: Tue Jun 18 19:27:36 EDT 2013
[INFO] Final Memory: 5M/15M
[INFO] ------------------------------------------------------------------------
C:\MavenApps\simple-webapp>


... but I am left wondering.... should it leave the directory structure and contents lying around in the "target" folder like that ?? 'Just curious.

thanks,
--- andyj

 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34095
337
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Andy,
Yes. As you noticed "install" has a few pre-reqs. A few of which are to create artifacts. Target is the destination for those artifacts. They stay there in case you want to look at the junit report, jars, etc.
 
Andrew Jerpe
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That makes sense. Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic