I recently created a basic HelloWorld ODL module as stepped out here, and I am able to make it work. I.e., I can run restful POST commands against it and get my "hello" reply.
{
"output": {
"greeting": "Hello Andrew"
}
}
Now, what I'd like to do is install this module into the actual ODL as compiled from the integration distro repos.
The steps I follow are:
Successfully create the HelloWorld ODL module and run karaf from within the HelloWorld karaf subfolder
Knowing that mvn install against the Hello project will publish this module into my local .m2/repository/org/opendaylight/hello repo, I move on to the actual ODL integration/distro
in the features/repos/index/pom.xml file in ODL, I add the following profile:
<profile>
<id>hello</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<dependencies>
<dependency>
<groupId>org.opendaylight.hello</groupId>
<artifactId>features-hello</artifactId>
<classifier>features</classifier>
<version>1.0-SNAPSHOT</version>
<type>xml</type>
</dependency>
</dependencies>
</profile>
Then I successfully run mvn install on ODL and it does not error on that profile. (Note: if I typo anything in that profile section, the mvn install will fail)
I am doing everything to ODL v0.11.0 and Sodium 1.2.0 in my application, so I am sure the versions are correct.
All is said and done, the ODL karaf does fire up and I am able to run rest commands against it... however the same POST command that worked purely against the HelloWorld module does not work in the integrated distro ODL. Instead I get this error message back:
{
"errors": {
"error": [
{
"error-type": "protocol",
"error-tag": "unknown-element",
"error-message": "The module named 'hello' does not exist."
}
]
}
}
In some ways, this question is a bit of an extension to my previous one here: Source code of the full OpenDaylight Integration Distribution Bundle. So just linking them together here.
Update:
I created an inverse to this question here: Procedure to add features to OpenDaylight application.
Note:
In the feature:list section, I do not see Hello listed
ODL Integration distribution does not install any karaf feature by default, so once you start the distribution, check whether your project feature is installed (e.g. feature:list -i). If it is not, just install it (e.g. feature:install ).
Related
When attempting to create a package for my ui.apps folder with maven I receive this error
data-sly-set: None of the registered plugins can handle the
data-sly-set block element.
I am indeed using the data-sly-set property like so
<sly data-sly-set.index="${mylist.count}"></sly>
And it does work on my local instance it just fails validation when packaging it.
I noticed that htl-maven-plugin was on version 1.0.6 if that is related.
The issue was that the version of htl-maven-plugin was too old. I resolved this issue by going into pom.xml and added
<version>1.3.4-1.4.0</version>
underneath
<artifactId>htl-maven-plugin</artifactId>
It ended up looking like this
<plugin>
<groupId>org.apache.sling</groupId>
<artifactId>htl-maven-plugin</artifactId>
<version>1.3.4-1.4.0</version>
</plugin>
After that it I ran
mvn -PautoInstallPackage clean install
and it built successfully. I also ran
mvn versions:display-plugin-updates
earlier to force it to update but I'm not entirely sure if that was necessary.
Iam searching for a maven based solution to deploy apache sling bundle and content (including jsp/html, etc files) on my sling standalone server.
I stated this private project to learn about sightly and sling models without using AEM. It is my first only sling project.
Ive created a sling bundle and a sling content project from the specific archetypes. Ive stated working with the Eclipse Sling IDE tools, but iam used to IntelliJ and there is no plugin to deploy the contetent the same way. I think its possible to build and deploy a package with both (bundle and content) by using maven.
Hopefully someone of you have some instructions or ideas to solve this problem and make it more comfortable developing web projects with apache sling.
Cheers ;)
The maven-sling-plugin can install bundles in a Sling instance, and bundles can include initial content which is installed when they become active.
The slingbucks sample demonstrates this, if you build it as shown below it will be installed in the Sling instance running on port 8080 and its initial content (defined under src/main/resources/SLING-CONTENT as specified in that module's pom.xml) will be installed:
mvn clean install org.apache.sling:maven-sling-plugin:install -Dsling.url=http://localhost:8080/system/console
If you use the Sling parent pom you can also use the autoInstallBundle profile to do the same thing using the default URL that that pom defines:
mvn clean install -P autoInstallBundle
This project may help you https://github.com/auniverseaway/slick, see the pom.xml file there
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.0.1</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Sling-Initial-Content>
jcr_root/content;
overwriteProperties:=false;
overwrite:=false;
uninstall:=false;
path:=/content;
maven:mount:=false,
jcr_root/apps/slick;
overwrite:=true;
path:=/apps/slick;
maven:mount:=false,
jcr_root/apps/sling;
overwrite:=true;
path:=/apps/sling;
maven:mount:=false,
jcr_root/etc;
path:=/etc;
overwriteProperties:=false;
uninstall:=false,
jcr_root/i18n;
path:=/etc/i18n/net.zum.slick;
overwrite:=true;uninstall:=true
</Sling-Initial-Content>
<Bundle-Activator>net.zum.slick.internal.Activator</Bundle-Activator>
<Sling-Model-Packages>
net.zum.slick
</Sling-Model-Packages>
</instructions>
</configuration>
</plugin>
All in all the files inside the directories defined in <Sling-Initial-Content> space of the maven-bundle-plugin will be deployed with the bundle, correct?
I'm trying to follow this guide here http://www.ibm.com/developerworks/web/library/wa-oauthsupport/index.html which gives information on how to use the OAuth client library provided by OAuth and HTTPClient 4 to authenticate your connection. I am working on a Java Swing CLIENT, NOT a OAuth PROVIDER.
OAuth provides a client library here on this page http://oauth.net/code/
I'm talking about the one marked by "A Java library and examples were contributed by John Kristian, Praveen Alavilli and Dirk Balfanz." which points to an SVN repository http://oauth.googlecode.com/svn/code/java/core/
I do not understand how to incorporate this library into my Eclipse project. I would like to just be able to add a maven dependency because it's so clean and works so well. I don't see coordinates readily available, and when I look at http://oauth.googlecode.com/svn/code/java/pom.xml I see the following coordinates but they don't work when I run the Maven build with the coordinates, and I get a "Missing artifact net.oauth:oauth-parent:jar:20100601" error in Eclipse's integrated Maven 3 pom.xml manager. I thought the entire point of Mavenizing a project was so that you could use its coordinates to pull it in.
<dependency>
<groupId>net.oauth</groupId>
<artifactId>oauth-parent</artifactId>
<version>20100601</version>
<packaging>pom</packaging>
</dependency>
I've tried the follow dependency after snooping around on the maven repository, and it didn't have all the classes/interfaces/etc I needed.
<dependency>
<groupId>net.oauth.core</groupId>
<artifactId>oauth</artifactId>
<version>20100527</version>
</dependency>
Is this the wrong way to incorporate this project? Is it not truly mavenized in a way that makes it easy to share? If I can't use Maven, what's the best path to follow to include this library into my project?
This is a bit of a repeat of How to include oauth library in Eclipse? but that question doesn't address the Maven aspect of it at all.
The OAUth libs doesn't seem to be available in Maven Central, so you have to add the following repository either to your settings.xml or to your pom.xml:
<repository>
<id>oauth</id>
<name>OAuth Repository</name>
<url>http://oauth.googlecode.com/svn/code/maven</url>
</repository>
I actually found the way to make it work with exactly your version of oauth-parent:
Create a directory and enter it:
mkdir oauth && cd oauth
Checkout code for your version:
svn co http://oauth.googlecode.com/svn/code/java/
Enter checked out directory (java), compile and deploy jars yourself:
cd java && mvn source:jar install
After that your dependency will work:
<dependency>
<groupId>net.oauth</groupId>
<artifactId>oauth-parent</artifactId>
<version>20100601</version>
<packaging>pom</packaging>
</dependency>
I'm trying to setup maven cargo plugin. I have the following requirements:
tomcat 6
custom server.xml
custom context.xml
log4j jar deployed to tomcat lib
install tomcat on the machine if it's not there already
tie to maven's install lifecycle phase to deploy a war and restart the container
make the deployed war be ROOT.war
I've followed the following: http://www.java-tutorial.ch/maven/maven-tomcat-deployment-using-cargo. This isn't the complete feature set I want, and even it doesn't work entirely. This is what I get:
Can't load log handler "4host-manager.org.apache.juli.FileHandler"
[INFO] [talledLocalContainer] java.lang.ClassNotFoundException: 4host-manager.org.apache.juli.FileHandler
And then when mvn install returns I do ps -ef and there's no tomcat process.
Also it copies the war to ROOT.war but the old ROOT/ directory is not replaced so the new ROOT.war doesn't actually get deployed.
For the "install tomcat if not already there" requirement, it seems like this should be absolutely straightforward, yet when I provide
<zipUrlInstaller>
<url>http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.32/bin/apache-tomcat-6.0.32.zip</url>
<extractDir>/usr/local</extractDir>
</zipUrlInstaller>
and run mvn cargo:install, it throws this:
org.codehaus.cargo.container.ContainerException: Failed to get container installation home as the container has not yet been installed. Please call install() first.
Which is puzzling. It wants me to call install first, but I AM calling install.
Ideas?
Link you followed has given demo for cargo 1.0.6. Recent version available is 1.1.1 so I suggest you to use recent and there is certain changes in child tags
As described in post http://cargo.codehaus.org/Deploying+to+a+running+container. There are ceratin changes in child tags of ZipUrlInstaller.
<!--
Careful: As described in the ZipUrlInstaller documentation,
Cargo versions older than 1.1.0 accept only installDir, you therefore
need to set installDir instead of downloadDir and extractDir.
-->
Try to use maven archetype to create cargo sample project following post http://cargo.codehaus.org/Maven2+Archetypes. I suggest you to user "Single Webapp Module Archetype"
After setting up maven project, You can install tomcat 6 running mvn cargo:install -P tomcat6x command.
pom.xml snippet of "single webapp module archetype" which can be useful for you.
<profiles>
<profile>
<id>tomcat6x</id>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<configuration>
<wait>true</wait>
<container>
<containerId>tomcat6x</containerId>
<!-- download zip url -->
<zipUrlInstaller>
<url>http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.32/bin/apache-tomcat-6.0.32.zip</url>
<downloadDir>${project.build.directory}/downloads</downloadDir>
<extractDir>${project.build.directory}/extracts</extractDir>
</zipUrlInstaller>
</container>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
</profiles>
where wait parameter true will give you option to check whether server is running or not.
I would like to be able to deploy only the POM artifact (file) without the main artifact (JAR, WAR, etc), when running mvn deploy and version is a SNAPSHOT version.
Why?
We several developers working on multiple Maven projects. We have a Hudson server with a job per Maven project and version (e.g. foo-1.2, foo-1.3). Each job builds the project and deploys it to a Nexus server (upon success). Maven projects under development are marked as such by using -SNAPSHOT postfix in the version. For example: 1.2-SNAPSHOT, 1.3-SNAPSHOT.
Here's a sample scenario how a developer work is damaged due to this architecture.
Assume two Maven projects: foo-core and foo-webapp, both at version 1.2-SNAPSHOT.
Developer A is working on foo-core, made several changes and compiled it.
Developer A continues to work, but on foo-webapp.
Developer B started working and changing foo-core. It commits his work and pushes it to the SCM.
Hudson is triggered by SCM; Builds foo-core and deploys it to the snapshot repository in Nexus.
Developer A is running mvn install on foo-webapp. Maven is checking with Nexus, and finds that there is a newer version of foo-core in Nexus. It downloads it (filled with developer B changes) and than it fails compilation, since the changes made by developer A are not in the jar located in the local repository. The download overrides the file installed there by developer A.
Existing Solutions
I looked into maven-deploy-plugin, but this plugin deploys all artifacts attached to the project. If they had a way to configure which artifacts to deploy, it would have been great.
Question: Is there any way to solve this without resorting to writing my own deploy plugin, based on maven-deploy-plugin?
Basically to the -Dfile parameter, instead of the artifact, pass the pom.xml. Run the command and yay! mvn deploy won't give you any issues now. Here's a sample deploy command :
$ mvn deploy:deploy-file -DpomFile=pom.xml -Dfile=./pom.xml -DgroupId=my.group.id -DartifactId=artifact-id -DrepositoryId=bigdata-upload-snapshots -Durl=http://maven.mymaven.com/content/repositories/snapshots/
A prerequisite for this is that the repository be added in your settings.xml
[Edit]: I have supplied the parameters -DgroupId and -DartifactId of the project in the sample deploy command but they're not required (refer to Zac's comment below)
I never heard of such a possibility and also would be very astonished if that would be possible. As the pom and the resulting artifact are some kind of unit it would make no scence (to me) to deploy only parts of them.
Nevertheless you should consider to make a separate pom project which specified dependencies and plugins you might want to use on your JAR/WAR projects like this:
<groupId>foo.bar</groupId>
<artifactId>my-pom</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging>
and then inherit that pom project by your JAR/WAR projects like this:
<parent>
<groupId>foo.bar</groupId>
<artifactId>my-pom</artifactId>
<version>1.0.0</version>
</parent>
This is called project inheritance. You can change and deploy your pom project independent of the "child" artifacts.
EDIT after reading motivation:
As I understand you want to prevent maven to resolve SNAPSHOT artifacts from a repository (so that local version won't be overwritten). Have you ever tried to use the mvn -nsu option (see mvn -help)?
-nsu,--no-snapshot-updates Suppress SNAPSHOT updates
I never tried it but found this reported issue. Nevertheless I would give it a try (as the issue is not commented yet).
This works for me for deploying a pom file only (e.g next to an existing jar):
(Note: you need to specify packaging also, otherwise it will be uploaded as an .xml file which is not what you want.)
mvn deploy:deploy-file \
-Dfile=pom.xml \
-Dpackaging=pom \
-DgroupId=com.mycompany.package \
-DartifactId=my-artifact \
-Dversion=2.0.1 \
-DrepositoryId=serverIdFromSettingsXMLForCredentials \
-Durl=http://repositoryserver/myrepo/
Not exactly the answer these folks were asking for. My situation was I wanted to deploy only the parent pom. I'm using the spring-boot-thin-layout in a child module. This requires the parent module be deployed into artifactory. I added the following into my project. It enables skipping of install and/or deploy phase.
In my parent pom:
<properties>
<disable.install>true</disable.install>
<disable.deploy>true</disable.deploy>
<enable.deployAtEnd>true</enable.deployAtEnd>
</properties>
<profiles>
<profile>
<id>deploy-parent</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<disable.install>true</disable.install>
<disable.deploy>true</disable.deploy>
<deployAtEnd>${enable.deployAtEnd}</deployAtEnd>
</properties>
<build>
<finalName>${project.version}</finalName>
</build>
</profile>
</profiles>
And the in my child pom(s) or any module you don't want deployed with parent:
<properties>
<maven.install.skip>${disable.install}</maven.install.skip>
<maven.deploy.skip>${disable.deploy}</maven.deploy.skip>
<deployAtEnd>${enable.deployAtEnd}</deployAtEnd>
</properties>
So effectively when I run mvn deploy on the parent pom, it will compile all the modules, not run install on anything, and then at the end deploy any module not having `