How to skip enlisting a certain child module from a parent's maven site - maven-site-plugin

Suppose, I have a parent pom with following modules:
moduleA
moduleB
moduleC
Note: I have not created a site.xml for the parent project
When I do a mvn clean site:attach-descriptor site site:stage on the parent project, the index.html file generated in the parent-project-folder/target/staging, displays a modules section enlisting all the modules(moduleA,moduleB and moduleC) that link to their respective staged site content. But I have skipped site generation for moduleB and hence site folder for moduleB is not generated. Is there a way by which I can exclude moduleB from being enlisted in the modules section of the parent project's maven site? Because, if it is present, the link refers to a page not found as there is no site content for this module.

Related

how to create a scala sbt project model which represents a model to other sbt projects?

i have a scala js sbt project, i developped in this project new user interface components.
the person p1 has a project with the same structure (same build.properties & plugins.sbt), how can he access to my user interface components.
Should i add some specification in build.sbt ?
If you want to share some project settings, you can create a sbt plugin - it will allow you to have some common settings, add dependencies to other sbt plugins and even override their configuration. See for example sbt-softwaremill as a example of plugin that is used to share some commons between projects.
It won't magically update all configs, because:
build.properties is evaluated before the sbt code is run
you have to add this plugin to plugins.sbt
you have to create project structure in each project
Any more config sharing than that is theoretically possible by e.g. using git submodules and commiting symlinks to repo, but that would be pretty wrong - any change to one project would result in a change in another project, and you have them separated for a reason - if both projects were the same you would have one project in the first place.
And if you are need to share the code itself, you can build the code, publish it to an artifactory and add dependency in another project.
But that's only if you really have two projects, and it's entirely possible that you just need to have one git project with different branches, where ever developer would work on their own branch and then merge changes to common branch, bacause that's the point of using git.

Commit multi-module maven project to SVN

I used Maven to create several projects in Eclipse, based on Maven archetypes, and ended up with this project structure (a parent project with multiple modules):
Parent project - pom.xml:
<name>backoffice-root</name>
<modules>
<module>backoffice-web</module>
<module>backoffice-ejb-core</module>
<module>backoffice-ws</module>
<module>backoffice-ear</module>
</modules>
Now I want to commit them to a SVN repository using Subclipse.
In my first approach, I added these projects to SVN in a flat hierarchy. The first project that I added was root, otherwise I'd get a warning saying that .svn folders in modules would be deleted:
backoffice-root
backoffice-web
backoffice-ejb-core
backoffice-ws
backoffice-ear
If I try to commit after that I get an error "backoffice-root/backoffice-web is already under version control". I believe this happens because when I added the projects to SVN, a .svn folder was created inside each one of them, but I don't know how can I solve this problem without deleting these folders and losing the information contained within them.
So I tried a second approach: adding root to SVN and then all the others under root (mapping my Maven project structure to SVN repository), creating this structure in the repository:
backoffice-root
backoffice-web
backoffice-ejb-core
backoffice-ws
backoffice-ear
But when I try to commit all of them, I get the same error of approach #1.
The only way that I get things to work is by just adding root to SVN and committing it (it commits all the modules since they are folders inside root). But I want to work on each project and commit them individually. Do I need to structure my Maven projects in a flat layout like explained in this post? How does one work this way with my original layout?
I'm working with the same your layout and everythings work. My project's skeleton is the following:
parent
-model
-util
-services
-web
model,util,services and web are all modules to parent and are placed in parent directory. Then I committed the parent project (that contains all modules) and finally I checked out and importing (In eclipse File->Import->Maven->Existing Maven Project) all modules.
Update1
Try to describe the procedure along some screenshoot:
Step1 I already committed the parent and all modules
After checkout you will wind the following situation:
where only the parent is linked with the svn. Now you have to do (File->Import->Maven->Existing Maven Project and selected all modules. Then automatically you will have all modules linked at the svn
Update2
My parent definition is the following:
<modules>
<module>model</module>
<module>util</module>
<module>services</module>
<module>vaadin-webapp</module>
</modules>
and each module has instead this configuration
<parent>
<groupId>myCompany</groupId>
<artifactId>myProject</artifactId>
<version>2.2.1-SNAPSHOT</version>
</parent>

Multi module maven project in a new local git repository?

Yesterday and today i converted my eclipse juno project to multi module maven project in eclipse. I have 1 maven project of type 'pom-root' and all my other projects are modules. The modules have the root project as parent. This works correctly.
A few hours ago i did try to add the root project to egit, by simply right clicking the root project and picking share project -> egit.
I first created a new repository in a new directory, the result was that all my module project became empty and all source files were copied to the repository directory. Gladly i did see that and could recover easily by copying the files back.
Next after the failed attempt i tried to create the repository in the parent folder of project. This failed somehow and the root project became corrupt. After a lot of fiddling around i deleted the corrupt root project and created a new one of type 'pom-root', and somehow i managed to get everything running again.
Next i surfed to stackoverflow ( :-) ) and ask my question:
How can i put my multi module maven project in a new local git repository? (without losing or corrupting everything)
Summary: Delete your Eclipse projects (just their metadata, NOT their contents), then re-create them by importing them from the local repo.
Caveat: I'm at the "a little knowledge is a dangerous thing" stage, so treat this with suspicion.
I just went through this, and I think I have a solution/workaround.
The problem, I believe, is that most of Eclipse still doesn't grok projects nested inside other projects. When you shared your root project, EGit moved all of your project's files out of the Eclipse workspace into the local git repo and then updated Eclipse's metadata for the root project to reflect the new location of the files (good), but (since it is clueless about nested projects) that means it treated all the files in your child modules as though they were part of your root project and hence moved them into the git repo (that's OK) but didn't update the Eclipse project metadata for those child modules (that's bad). So Eclipse shows that you now have a bunch of (child) projects that don't have any files (not even a .project file, nor pom.xml). But if you ignore Eclipse and look directly in the working directory of the git repo, they're all sitting there happily (i.e. EGit copied the directory structure and all the files, including the child modules) and from git's perspective they are all currently untracked.
The solution (I believe) is: delete your Eclipse projects. No, really. But very carefully; see below. [Just to be safe, maybe use e.g. zip to take a backup copy of your lovely files that are sitting in the working directory of the repo. If they were already staged or committed this would be moot, but presumably at this point they aren't].
When you select each Eclipse project and right-click Delete, make sure that the "Delete project contents on disk (cannot be undone)" checkbox is NOT checked -- in other words, you are deleting the Eclipse metadata for each project (I did this for all the child modules and even for the root project) but you aren't deleting the files that are sitting in the working directory of the repo.
(I was worried that m2e might be too "helpful" and, as I deleted each child module, it might remove it from the parent's pom.xml, but thankfully that didn't seem to happen).
In the Eclipse Preferences for Team - Git - Projects, I do have "Auto share projects located in a git repository" enabled. That makes life easier but I assume that you could use less automagic approaches if you preferred.
Once all the relevant Eclipse projects have been deleted, use the Git Repositories view to Import Maven Projects; this creates new Eclipse projects (for the root project and for the child modules) with valid metadata that points to the files in the repo. Hallelujah.
I believe this works because one part of Eclipse that isn't clueless about nested projects is the import-maven-projects logic in m2e.
At this point all the files are still untracked, so next you probably want to select the root project and right-click Team --> Add to Index (which will also add all the child modules, I assume because it's oblivious to the nested projects and just treats them as extra files in the root project).
I wondered what would happen if I then added a new child module -- would it "just work" (and be shared in the git repo) or would it require more gyrations? I was pleased to find that (as far as I can see) it "just works": the Eclipse project metadata shows the files in the right place (in the git repo, as a child under the root project) and marks the project as shared in git.
So my guess is that if you or I had a time machine, the easy way to do this would have been to create the root Maven project, share that to EGit, and only then start creating the child Maven modules.
My environment (though it probably doesn't matter):
Eclipse 4.3.1 (Kepler SR1) with the usual versions of its components: m2e 1.4.0, EGit 3.0.3, m2e EGit connector 0.14.0.

How to connect/sync just the src folder of the maven project in eclipse workspace to src folder in repository

I have commited just the src folder and pom.xml of maven project into SVN repository in order to make it independent of IDE (As .settings, .project etc are files specific to eclipse ide)
Then when I'm trying to import the src folder in a newly created maven project (as it has the other files which are needed to run the project in eclipse), basically I only want to synchronize the src folder and pom.xml with the repository, I get a warning while I import the src folder 'as a folder in existing project' AS 'Destination project is detached from the source control. So please take into consideration that the plug-in won't provide any SVN actions for these resources' and then I'm not able to use Compare with and Team Options. It doesn't even show the revision no. besides the imported class files and folders.
Is there a way to do this ??
What is/are the usual industry practice/s ??
There're 2 options.
1.) Check out the SVN files using some other tool e.g. (TortoiseSVN) and then import the maven project using 'Materialize Maven Project'. This will create necessary metadata for eclipse and will also maintain the version info for the checked out project. See this reference http://www.sonatype.com/books/m2eclipse-book/reference/creating-sect-importing-projects.html
2.) The (better) other way is to download 'Maven SVN Integration' plugin using update site
http://m2eclipse.sonatype.org/sites/m2e-extras/. Once you install the plugin, you would be able to see option 'Check out as Maven Project' in SVN repository exploring perspective.
Thanks,
Prabhjot

Maven Multi-module projects with SVN

I have a Maven multi-module project (one parent project with three children). The parents packaging is set to POM.
The issue is SVN wont check in the source code of the child projects (only their pom.xml files). Is there a solution to this?
try this:
first, checkout your parent project, which includes its several children project folders;
after checkout is finished, "File"->"Import"->"Existing Maven Projects", and select the parent project into "Root Directory", you'll see the children project in the "Projects" diagram,
then just select the ones as you want!