Unable to build AEM maven project because failed to resolve cndNames - maven

I am unable to build a maven AEM project because of failure to resolve cndNames.
Failed to execute goal net.adamcin.oakpal:oakpal-maven-plugin:1.5.1:scan (default) on project *******: Failed to execute package scan. Failed to resolve cndNames.: Failed to find node type definition on classpath for cndName exportnodetype.jsp
Can someone please help me out here?

The plugin you're referring to is responsible for validating the content of your package against a predefined set of node types.
Node type definitions can be used to restrict the structure of nodes in the Java Content Repository and they can be managed per instance. Some node types come out-of-the-box, such as nt:unstructured, nt:file, nt:folder and some may be specific to your project or a 3rd party tool you've installed.
In general, the content packages you're installing should only contain serialised content matching known node types. This is what the plugin validates as the project is built. In order to do that, the plugin requires a file with node type definitions, telling it what your AEM instance can recognise.
The error suggests that the plugin is failing to load this file. The documentation describes the steps required to export node types and configure the plugin by adding the definitions as a classpath resource, e.g. under src/test/resources
If the documentation doesn't help, consider having a look at the sources of the plugin to understand what it does when it's throwing the exception.

Related

Jenkins build, hudson.FilePath is missing

while building a pipeline on Jenkins for building a springboot application, I noticed that the build fails with the following message: Required context class hudson.FilePath is missing. Searching on the internet I find examples of json configurations to be provided to the Jenkins service. My doubt is on the web interface: https://prnt.sc/6SIZKYRmfYGI where it allows me to create pipelines, but I don't know where to fill in the required filepath. Would anyone know how to give me directions?

Problem while using Vulas for scanning gradle projects

I am trying scan my projects in gradle using Vulas and always get the same error:
"Application context is required to execute goal APP."
Could you tell me what is missing or what exactly this error means? What exactly Vulas is trying to looking for?
Thanks.
The root cause of this error is that Vulas does not know the application's unique identifier.
How to specify this identifier depends on the programming language and build tool:
Maven (Java): The identifier is automatically taken from pom.xml.
Gradle (Java): The identifier is partly taken from build.gradle and has to be complemented with information from gradle.properties (properties group and version).
Setuptools (Python): The identifier is automatically taken from setup.py.
CLI: The identifier has to be specified using configuration parameters vulas.core.appContext.group, vulas.core.appContext.artifact and vulas.core.appContext.version.
Cheers, Henrik

Correct way to generate feature files for Karaf?

I am trying to create a Karaf assembly using Maven (and NetBeans). I create my bundles using declarative services, but I am having problems creating feature files. Part of my problem is the error messages that OSGi generates. But I have a more general questions.
I have discovered that I can call karaf-maven-plugin in the project that creates my bundles and it generates what appears to be a comprehensively populated feature file based on the dependencies of the bundle. (Method 1)
However, I have read somewhere that creating a feature file with karaf-maven-plugin should normally only be done in a project with feature packaging. If I do this, it seems to me that I have to create the feature file by hand, which is not a lot of fun. (Method 2)
No matter which method I use, I have been unable to successfully generate a Karaf assembly that contains anything other than simple bundles without any dependencies. I am currently stuck trying to install a single bundle that needs to wrap some non-OSGi dependencies. Method 1 above generates the wrap stuff (<feature> and wrap: protocol). All I get is the following error:
Failed to execute goal org.apache.karaf.tooling:karaf-maven-plugin:4.1.0:assembly (default-assembly) on project EnoceanBridgeAdmin: Unable to build assembly: [wrap/0.0.0]
EnoceanBridgeAdmin is the karaf-assembly packaging that I'm trying to build. It has a dependency on the bundle that contains the generated feature file (where wrap is referenced):
<dependency>
<groupId>net.winnall.enocean.service.impl</groupId>
<artifactId>EnoceanBridgeSASS.Impl</artifactId>
<version>0.99.99</version>
<type>xml</type>
<classifier>features</classifier>
</dependency>
So my questions:
Is method 1 above a correct usage?
Can I automatically generate a feature file to use method 2?
Will the error message disappear after I've got method 1 or 2 sorted?
Steve
I have resolved this myself.
Method 1 does not work because karaf-maven-plugin generates <feature> definitions for wrap. These cause the error mentioned above. Apparently – at least with Karaf 4.1.0 – the wrap: protocol is used in a feature file without a prior <feature> definition.
Method 2 (writing the feature file yourself) is thus the only viable option because of the behaviour of karaf-maven-plugin.
Yes, the error message disappeared :-)

Exception: org.exolab.castor.xml.ValidationException was not added to the list of sorted types

I am trying to deploy EAR file on Websphere Application Server but while deploying it's showing an error.
ERROR CODE:
SEVERER: Exception org.exolab.castor.xml.ValidationException was not added to the list of sorted types.
The project was not built since its build path is incomplete. Cannot find the class file for org.exolab.castor.xml.ValidationException. Fix the build path then try building this project.
I am using Castor in my project but it's there in classpath which i am setting through Shellscript.
Thanks for help in advance.
Your dependencies need to be expressed to the application server runtime, not added to some shell variable or standalone java invocation. Either package them in your application or create an isolated shared library and associate it with your dependent application.

Acceleo maven generation multi artifact/project

I am trying to construct a maven acceleo generator.
The generator consists of multiple acceleo projects (artifacts in maven), with inter-dependencies.
I am running into a problem with the dependencies between emtl files.
At runtime, I get errors stating that there are compilation errors in the mtl, (there are not).
I am guessing it may be the hrefs within the compiled emtl files.
There is an acceleo maven compile plugin that allows for these to be either:
a) absolute paths (ending up to be via the maven repository)
b) 'platform:/plugin/...' paths.
(a) works if the acceleo projects (maven artifacts) are build on the same machine as the one on which we do the generation, but if the location of the maven repository changes, we have a problem. Hence deploying the maven artifacts ends up being pointless.
(b) doesn't work because running from within maven, 'platform:/plugin/' cannot be resolved.
I have tried to override the 'createURIConverter' method in the AbstractAcceleoGenerator,
then using a URLClassLoader we can decode the 'platform:/plugin/' hrefs and find the correct emtl file.
I can verify that this seems to be working, however I still get the reported
"org.eclipse.acceleo.engine.AcceleoEvaluationException: Unresolved compilation error in generation module"
any suggestions?
The exception was caused by hrefs in the EMTL model resolving to null.
The problem with resolving the hrefs was just a lack of resource factories being registered (the exception informing me of this gets lost in EcoreUtil.resolve which catches the exception with "// Failure to resolve is ignored." - most unhelpful).
So it seems that my approach of "override the ‘createURIConverter’ method, and get it to decode the ‘platform:/plugin/..’ using a URLClassLoader" does work.
Building the URLClassLoader using the same method done in the AcceleoParserMojo.

Resources