How generate documentation on maven? - maven

I am new with Maven, and now I am trying to generate the project documentation. Until now, I find that I only need to run the command
mvn site
or
mvn clean site
and thats all this command will generate the folder site inside target folder, and does it but also should generate some files main is index.html and here its the problem, command doesn't generetate those files, only the folders
I will hope the file index.html looks like
and those folders have files, like images and files *.css,
So I don't know if I need to do some steps before?
Also If you can recommend me a tutorial or documentation about it, thanks

I found the correct way to do it, because the tutorial that I was following it isn't full descriptive, it is why I'm confused. But I found the guide of maven to do it. Check it here Creating a site. So I need to create the folder site inside src path, and this folder should contain file site.xml which relates the different components of the site, those could be developed in different document types, in the page there are some links to know how to do it. So this is mine site.xml
<?xml version="1.0" encoding="UTF-8"?>
<project>
<body>
<menu name="Overview">
<item name="Introduction" href="index.html"/>
<item name="Goals" href="plugin-info.html"/>
</menu>
</body>
</project>
And I use the xDoc type, so I create xdoc folder inside site, this contains all the files related in site.xml (index.xml and plgin-info.xml in example)
so after that run the command mvn site and got this in targe\site

Related

Maven - how to build custom file structure including the output jar

I am building app with following structure (where myApp is root):
myApp\bin\myApp.jar
myApp\runMyApp.bat
So I need to 'wrap' the ouput jar in two directories and add to the outer directory myApp a script file.
How do I best set POM to do this?
Bonus question: I like the idea of making exe from bat. Currently I use a tool for that. Can something like this be achieved with Maven? Is having exe better than just bat file? (I did it mainly to insert the custom icon).
First off the AppAssembler plugin can be used to create the .bat file for your .jar. It may not support the exact layout you are after, but it should be customizable to get something rather close.
Secondly, the assembly plugin can then slurp all that up and produce a .zip file that has the layout you want and contains all the files you are after.
Other things to look into are the NSIS which can create a .exe windows installer for your application.
Tools such as launch4j can help wrap your entire application up in an .exe though I personally cannot find a nice maven way plugin for it.
I have used the assembly plugin to create custom output directories and have found it very powerful. You can specify the archive format of the output folder like zip, etc and also relative paths to files that need to be included in the zip. Dependencies for your project are included in by adding in the below into your custom assembly xml file - this will add in all the dependent jars as specified in the pom.xml
<dependencySets>
<dependencySet>
<outputDirectory>/</outputDirectory>
<useProjectArtifact>true</useProjectArtifact>
<unpack>false</unpack>
<scope>compile</scope>
<useTransitiveDependencies>false</useTransitiveDependencies>
</dependencySet>
</dependencySets>
Here is the link to the create your custom assembly descriptor - http://maven.apache.org/plugins/maven-assembly-plugin/assembly.html

Creating and populating subfolders Joomla manifest XML

I've become fairly confused when I'm trying to create a subfolder and populate it with things in my plugin manifest XML.
If I want to create a subfolder and at the same time add files to it, how would that be done? Read comments in the code draft (all names are of course more distinct than used here).
<?xml version="1.0" encoding="utf-8"?>
<extension type="plugin" version="2.5.0" group="group" method="upgrade">
<name>Handelsbanken Finans Delbetalning</name>
<!-- The following elements are optional and free of formatting conttraints -->
<creationDate>July 2013</creationDate>
<author>Emil Carlsson</author>
<authorUrl>http://valid.url</authorUrl>
<copyright>Copyright (C) 2013</copyright>
<version status="BETA">0.0.1</version>
<!-- The description is optional and defaults to the name -->
<description>Plugin description.</description>
<update> <!-- Runs on update; New in 1.6 -->
<schemas>
<schemapath type="mysql">sql/updates/mysql</schemapath>
</schemas>
</update>
<!-- Site Main File Copy Section -->
<!-- Note the folder attribute: This attribute describes the folder
to copy FROM in the package to install therefore files copied
in this section are copied from /site/ in the package -->
<files folder="site">
<filename>plgName.xml</filename>
<filename>plgName.php</filename>
<folder>helpers</folder>
</files>
</extension>
This gives me nothing really. I can't find the folder I shouldhave been created from what I gathered from the documentation. It also doesn't specifies how I populate these folder :(. I am assuming that it is possible to more or less just package all files I want and then it will create the subfolders where I want/need them. But that it is a question of how to write the manifest file. If anyone have a good tutorial about this I would be very thankful :). I've googled until my fingers are almost at the Point of bleeding :(. I guess I could put all the files in the same folder, but I want to have some sort of structure to visualize for other developers what's part of the core of the plugin and what's not part of the plugin core.
Problem is solved. In my not installation script I linked in the files for what I thought only was used by the configuration XML (a field to configurate the plugin). In this file I had the node "files" as well, in this node I'd not linked in the helpers directory. When this was done all the subdirectories was added as well. So in short - Don't forget to link in the folder in all places where you have a files-node.

JInstaller: :Install: Cannot find Joomla XML setup file

I create one template for joomla 2.5. But when I installed it it show the error:
"Failed loading XML file
D:\wamp\www\demoproject\tmp\install_51a44308e27b9\templateDetails.xml
XML: XML declaration allowed only at the start of the document
JInstaller: :Install: Cannot find Joomla XML setup file"
How can I solve it please?
It means your XML file isn't properly written. The actual error is:
XML declaration allowed only at the start of the document
Check the file and make sure
<?xml version="1.0" encoding="utf-8"?>
is the first line in the file. No line breaks or anything else is allowed before this.
That means you try to install the wrong .zip file. It happens often if you try to install a Joomla 1.5 template to a Joomla 1.6 website or the other way around.
Another common reason is, that you try to install the templates download package (<- the ZIP Archive with all the template stuff inside, like the psd file, the docs AND the installation files) , instead of the included installation file.
<extension version="2.5" type="template" client="site"> Try extension tag instead install.
<!DOCTYPE install PUBLIC "-//Joomla! 1.6//DTD template 1.0//EN" "http://www.joomla.org/xml/dtd/1.6/template-install.dtd"> Include the correct doc type.

Problem with CruiseControl.net configuration

I started using ccnet to build my project. This is quite new issue for me so I have some problems.
First thing: Why does ccnet copy directory with my project to another directory (ccnet creates new folder named the same as project name included in ccnet.config file and copies to them directory with my project)
Second thing: Dashboard page cannot show reports for recent build (When I click on any item in recent build then I get page: "The page Cannot be found" I suppose that page cannot link files with logs. but I don't know how to link it.
I create one publisher:
<publishers>
<xmllogger logDir="c:\Branches" />
Can anyone help me?
Just a question, does the batch file "C:\Branches\Scripts\Build Release.bat" perform that step?
Because I can't see anything obvious within the CruiseControl config to copy the files into "c:\Program Files\CruiseControl.NET\Sever\TestProject"...
In build Release script I just call devenv to compile my project
Not sure I fully understand the 'first thing' if you can elaborate on it I'll try to help.
On our system it performs an SVN checkout of the code to a specified location and builds it there. Even though our CCNet installation is on the same box as the SVN repository it still needs somewhere separate to build the project.
On the 'second thing' it sounds like you have not set the <webURL> element properly - not a major problem. If you can post your config file that may help (with both issues).
Our CCNet installation pretty much worked out of the box but it is pretty fussy about it's config files. Have you made any changes to the dashboard.config file or is it as installed?
[Edit in response to posted config file]
I can't see anything in this config that will cause CCNet to copy the project to c:\Program Files\CruiseControl.NET\Server\TestProject. It could be something to do with the way you are calling devenv in your batch file - do you specify any paths in there?
Based on your config file and assuming you have an out of the box installation, your <webURL> element should read something like this:
<webURL>http://localhost/ccnet/server/local/testProject/ViewProjectReport.aspx</webURL>
On top of all that I would highly recommend that you drop the use of .bat files and devenv.exe for building your projects. Although this is the way I started with CCNet I quickly found that using NAnt and MSBuild well worth the effort.
I Try explain it more.
I have my local copy of repository on the path: "c:\Branches\trunk"
here is my config file:
<cruiseControl>
<project name="testProject">
<webURL>http://localhost/ccnet/</webURL>
<triggers>
<intervalTrigger name="interval trigger" seconds="600" initialSeconds="30" />
</triggers>
<sourcecontrol type="svn" autoGetSource="true">
<trunkUrl>http://********/svn/general/provider/prototype/Trunk</trunkUrl>
<workingDirectory>C:\Branches\Trunk</workingDirectory>
<password>***********</password>
<username>*************</username>
</sourcecontrol>
<tasks>
<exec>
<description>Compile program</description>
<baseDirectory>C:\Branches\Trunk\</baseDirectory>
<buildTimeoutSeconds>9000</buildTimeoutSeconds>
<executable>C:\Branches\Scripts\Build Release.bat</executable>
</exec>
</tasks>
<publishers>
<xmllogger logDir="C:\Branches\Trunk\Logs" />
</publishers>
<state type="state" directory="C:\Branches\Trunk\Logs"></state>
</project>
</cruisecontrol>
I didn't change anything in dashboard.config File.
cnet copy all folder c:\Branches\Trunk
to new folder c:\Program Files\CruiseControl.NET\Sever\TestProject
First problem was cause because in previous version of config file i use filesystem as sourcecontrol. Right now this problem don't occur.
Second problem is not resolved, But I have one Idea, Does any configuration files should be placed in virtual directory?

Integrating MSTest with Cruise control for multiple projects

I have integrated MSTest with cruise control for single project by following the steps present in the below link.Its working fine
http://www.codeproject.com/KB/tips/VSTS2008_Tests_With_CCNET.aspx?display=Print.
But if i add multiple projects, the result file is getting over wrtitten by 2nd project result. I am not able to see the first project result.
Please let me know how i can display multiple project results in result fie.
... in the meantime I checked the problem in more detail and it seems that my 1st guess was right (although I didn't realize that no real build script but a simple batch is used):
Problem: A single working directory is used for all projects. Each project produces it's own results.xml file but since they are all stored in the same location results are overwritten.
Solution: Use a separate folder for the results of each project (e.g. the project's artifact directory which is passed from CruiseControl to the batch process as environment variable).
RunTests.bat:
del "%CCNetArtifactDirectory%\results.xml"
MSTest.exe /testcontainer:<PathtoTestProject>\Bin\Debug\TestAssembly.dll /resultsfile:"%CCNetArtifactDirectory%\results.xml"
ccnet.config:
<project name="ProjectA">
<cb:define projectArtifactDirectory="C:\path\to\data\of\ProjectA" />
...
<artifactDirectory>$(projectArtifactDirectory)</artifactDirectory>
...
<publishers>
<merge>
<files>
<file>$(projectArtifactDirectory)\results.xml</file>
</files>
</merge>
</publishers>
...
</project>

Resources