How to use multiple alfresco AMP file in eclipse - eclipse

I have created one Alfresco project in Eclipse. I want to use one uploader-plus AMP file in my newly created Alfresco project in Eclipse.
How can I achieve this?
can we use multiple amps in single alfresco project in eclipse or can we create single amp file by combining 2 different amp files???

Independently from the IDE you are using, it is possible to setup an All-In-One project to fetch and apply several extra amps before starting up (either from a local or a remote maven repo) :
Create a new amp (Optional)
Build a release for your amp (Optional)
Add dependency for your amp in your project (You may need to add a repository as well)
Add an overlay for your amp to either share or repo (depending on the nature of your amp)
Run and enjoy
To learn more about this process please check the official documentation here
UPDATE : In the case of uploader-plus amps, you need either to fetch projects from here and install them locally (using mvn clean install) or add reference in your pom to this maven repo :
https://oss.sonatype.org/content/repositories/releases/ but I can see only v1.2 is released there so you probably would want to stick to option 1 !

Related

Reuse Bitbucket instance when developing multiple plugins

I am looking into bitbucket server plugin development and using atlas on mac. From what I understand in the tutorials, you write your code and run atlas-run to execute - but this downloads the entire bitbucket application.
Is there a way to download this implementation once and share among plugins for development? Or to tell atlas the location of the shared instance?
As I mentioned in my comment the download process relies on maven repository find ~/.m2/repository/com/atlassian/ -name \*.war returns
~/.m2/repository/com/atlassian//bitbucket/server/bitbucket-webapp/5.5.2/bitbucket-webapp-5.5.2.war
So as long as you use the same maven repo and use the same BB version it will reuse the existing war file from the maven repo

is site.xml compulsory for eclipse update site?

I have used eclipse Features And Bundles Publisher to create a p2 metadata folder. But failed add the same folder as local site as eclipse keep on complaining Unable to find the site.
I could find content.xml and artifacts.xml but site.xml NOT generated through publisher command. I doubt if I have to create a site.xml manually.
FYI I am using eclipse KeplerSR2.
The p2 publisher should create a structure like this. Depending on pack attributed the content and artifact repository files [content and artifact] might be jared.
<repo-root-dir>
features
featureA.jar
...
plugins
pluginA.jar
...
content[.xml|.jar]
artifacts[.xml|.jar]
You won't get and won't require an update site file.
Make sure to clean the location you use from the Eclipse -> Preferences -> Available Softwares Sites. Eclipse is caching the repo metadata.
Yes you must have site.xml for update site from update_site
To create an update site you must develop a site.xml file and build the site. PDE provides an editor and project for creating sites. A site will contain one or more features organized into categories.
See how to create site.xml

Tycho and Eclipse: How to resolve OSGI dependencies to my own bundles at development time within Eclipse, without opening all of them in the IDE

Background
My Eclipse RCP application is built using Tycho. It consists of multiple components (in the form of OSGi bundles/Eclipse plug-ins). One of these component contains the product file and materializes the product.
There is a reactor POM at the application root, which builds all components in order, but I also want to build other components independently (using mvn deploy) .
Building such a single component works as follows:
Retrieve the latest versions of all the component's dependencies from our company (p2) repository.
Build the component.
Deploy the component to our company repository to be used as a dependency for other components itself.
Note: Our repository is a normal maven2 repository hosted on a Nexus, whose RCP artifacts are automatically mapped to a p2 repository format as well. This way, Tycho can use the p2 repository format to find dependencies, while the standard Maven deployment can be used. This works fine.
Note: My parent POM makes sure that we look for dependencies at the p2 repository URL. The deployment URL is the default maven2 format location of the repository. This works fine.
Problem
When building such a single component through the command-line (mvn deploy), Maven looks for intra-project dependencies in the p2 repository and they are correctly resolved (i.e. latest version is automatically downloaded and used in build).
However, when developing in Eclipse, the IDE cannot resolve them. The manifest files gives an error at each of my intra-project dependencies that they cannot be resolved.
Question
My question is: How can I make the Eclipse IDE look for dependencies (and new versions of dependencies) in either:
My local p2 repository (~/.m2/repository/p2/osgi/bundles)
My company p2 repository (nexus.mycompany.com/myproduct-snapshots/.meta/p2)
Ideally, it would look for them every time and fetch the latest version if a newer version is available.
If it does not use the p2 repository URLs in the POM, how should I configure Eclipse?
Example
Consider an eclipse plug-in com.mycompany.myproduct.fancy, which depends on another eclipse plug-in com.mycompany.myproduct.core.
Both also have a POM (configured for Tycho use), which (through their parent POM) have my Nexus repositories configured correctly: maven2 repository URL for deployment and p2 repository URL to look for dependencies.
First I deploy the core plug-in to my maven repository (using the default mvn deploy). The Nexus repository will provide this deployed plug-in in both maven and p2 format.
When I build the fancy component through the command line (using mvn install), the (earlier deployed) core component is found and downloaded automatically.
project/com.mycompany.myproduct.fancy$ mvn clean install
<searches in p2 repository, download core>
<builds fancy>
<SUCCESS>
When I open a new Eclipse workspace and open the fancy component, its Manifest (which contains its dependencies) gives the following error:
Bundle 'com.mycompany.myproduct.core' cannot be resolved.
My question is: how can I develop the fancy component in the Eclipse IDE without the need to open core as project in Eclipse.
Speculation
This is some speculation from my side. Please correct me if I'm wrong and any other solution to the actual problem is also welcome!
I know the m2e plug-in of the Eclipse IDE currently maps Maven POMs to Eclipse concepts (using m2e connectors). I have installed the dedicated Tycho connectors. For example, the mvn compile step is actually performed by the Eclipse JDT compiler.
I also know that when a complete Tycho product is started in Eclipse, it is run in the Eclipse PDE environment. For example, I need to a specify a target platform in my Run configuration.
I know I can open all components in my Eclipse workspace. This would solve the problem, but is not feasible as I have many components and this would break independent component development.
I assume the Eclipse m2e mapping and/or the PDE build environment is not smart enough to fetch (latest) dependencies automatically at build time. Please correct me if I'm wrong. :)
Therefore, I assume I need to specify the target platform at build time too. I have taken a look at Window > Preferences > Plug-in Development > Target Platform. I can add our p2 repository to the Target Platform, which solves the problem. However this gives many problems:
I need a feature containing all components for this to work. Only features can be added.
Every time I deploy a new build of a single component, I would have to rebuild the complete feature (to create a new feature version on our p2 repository).
Every time I update a component and build the feature, I would have to manually change the Target Platform.
If the above is all correct, I speculate I need an m2e connector (or a different one from the current one) that actually checks the p2 repositories specified in the POM when resolving the OSGi dependencies and automatically adds those to the target platform.
As indicated by Nick Wilson, you will need to install the m2e Tycho Configurator, which basically "links up" Eclipse and Tycho (i.e., makes Tycho available in Eclipse).
You should've been pointed towards it after having installed m2e, but you can also install it manually:
Go to Window > Preferences > Maven > Discovery.
Click the "Open Catalog" button. This will open the "m2e Marketplace" window.
Search for "tycho", this should give you the "Tycho Configurator" as sole search result.
Click "Finish", you're done.
I've had this issue as well, and it isn't simple to find the solution, so I hope this helps!
The "most automated" way to configure your target platform in Eclipse is to use a target file. That file can be checked in with your sources, so every developer only needs to open the file and click on "Set as Target Platform" to activate it. AFAIK there is no m2e connector or Eclipse plug-in which does that automatically.
Given your development process, setting up this target file is a little more tricky. Since you don't have a feature which contains the latest version of all your bundles, you need to include the bundles directly in the target file. This is not possible via the rich editor, but can be done with a text editor:
Create a target definition file, add your p2 repository, and select any feature from that p2 repository. Save the file.
Open the target file in a text editor, remove the <unit> entry for the feature you added.
Instead, add an entry for each of your bundles:
<unit id="a.bundle.symbolic.name" version="0.0.0"/>
This target file then contains the latest version of each of the listed bundles. To see the content, open the file with the "Target Editor" again and switch to the "Content" tab. This file can now be used by all developers.
Note: When a new version of one of the bundles is deployed to Nexus, the developers will only see that new version if they open the target file and choose "Set as Target Platform" again.

How can I automatically build multiple Eclipse Plug-In Projects as one Jenkins project?

we're using Jenkins as our build server. We have a Project which is built out of Eclipse Plug-Ins, a core project and several other plugins. Building the Core on Jenkins and using Sonar on it is relatively.
Now we want to create a Jenkins build where the whole Project is being automatically built and tested by Sonar. Internet research showed to change the packaging to "pom", which can't be done because the Tycho plugin needs to have packaging set to "eclipse-plugin".
What are we doing wrong and how do you setup a project like this in Jenkins?
If any additional information is needed, please do tell.
You should create an "umbrella" Maven project with pom packaging and make all of your other project modules of this aggregator. In addition however the whole group of projects need to be accessible from your SCM tool as a single entity. If you are using Subversion this is easily achievable by means of svn:externals, with other tools I suspect you'd have to alter your configuration. I suggest you also check out whether there's any Jenkins plugins that might be of help.
For git, you can use the submodules feature to achieve the same as with svn:externals. See for example mylyn, which probably comes close to what you are trying to achieve:
git clone git://git.eclipse.org/gitroot/mylyn/org.eclipse.mylyn.git
Given this example directory layout:
+ParentDir
-pom.xml
+ProjectA
-pom.xml
+ProjectB
+SubDirB
-pom.xml
Contents of pom.xml in ParentDir should include the following:
<packaging>pom</packaging>
<modules>
<module>ProjectA/pom.xml</module>
<module>ProjectB/SubDirB/pom.xml</module>
</modules>
And when you invoke Maven on this top-level POM, it will add ProjectA and ProjectB to the reactor list to be built.
This can be adapted for similar projects, and the <module> tag accepts relative paths, for example ../../SomeProject/pom.xml.

How to deal with Maven projects containing several internal artifacts?

I'm about to start working on a web-application and I'll be using Maven. I want the web-application to be an individual artifact. The web-application will end up depending on a couple of self written libraries (for example text-formatting), and each of these libraries should be an individual artifact.
What's the recommended way of achieving this separation while making it simple to code for both artifacts? I was thinking of creating one project for each artifact and import them one by one in Eclipse. However, if the pom for web-application has a dependency pointing at the self written library, I'll end up having to deploy a snapshot every time I want to see if the change I made stopped the web-application from crashing (in example).
I hope you understand what I am getting at. I'll be working with a couple more developers, and we're using Nexus to maintain our shared artifact repository.
I was thinking of creating one project for each artifact and import them one by one in Eclipse.
Yes, that's the recommended way.
However, if the pom for web-application has a dependency pointing at the self written library, I'll end up having to deploy a snapshot every time I want to see if the change I made stopped the web-application from crashing
During development, you can use "workspace resolution" i.e. configure Eclipse to resolve dependencies from the workspace. This way changes are immediately visible from the webapp. This is possible whether you are using m2eclipse or the maven eclipse plugin (and is actually the default behavior for both).
Below, an illustration for m2eclipse:
A good maven plugin for eclipse is capable of "workspace resolution", i.e. it will recognize if the dependency is also present in the workspace, and refer to the other project directly rather than adding a JAR to the build path.