Unable to create maven package for AEM due to use of data-sly-set - maven

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.

Related

Install fails in maven, but succeeds in IntelliJ directly

I have a project with many modules that compiles fine in intellij.
When I try to build it in maven (via clean install) I get "COMPILATION ERROR : " and many problems on a specific module, that on IntelliJ are just fine.
I tried restarting Intellij (and cleaned the caches), I tried to uninstall it and reinstall it, tried to uncheck and check reimport automatically, tried reimporitng all the projects, and building and installing them all (and succeeded), updating the repository path, tried to install new maven (3.6 instead of 3.3), and even tried to run maven via the terminal - all that didn't help.
EDIT: I even tried cleaning maven's cache like in here, but failed.
Maven clean succeeds.
I use mac.
So basically my project works, maven doesn't. What could be the problem?
The problem was that the project I included was a spring boot project, and that made maven confused (but unfortunately, IntelliJ was ok with it).
Adding this fixed the problem:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<classifier>exec</classifier>
</configuration>
</plugin>

How do i skip the license check when running the maven install?

I ran a mvn clean install on a big Java project that I work on, but it kept failing due to some files not having the proper license headers. Well, thats not my concern right now, how do I skip that? the actual error i am seeing is,
Failed to execute goal org.codehaus.mojo:license-maven-plugin:1.14:add-third-party (default) on project test-project: There are some dependencies with no license, please fill the file /Users/test-project/src/license/THIRD-PARTY.properties
I also tried this maven command, but it didn't work
mvn clean install -Dlicense.skip=true
Try skipping AddThirdParty mojo with -Dlicense.skipAddThirdParty=true.
In my case, it worked with just -Dlicense.skip, without =true.
<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>3.0</version>
</plugin>
I found this helpful
$ mvn license:help -Ddetail | fgrep skip
which gave me
-Dlicense.skipDownloadLicenses
you don't need to add =true because just defining it is enough.
This one works for me
-Dlicense.skipCheckLicense

Maven install goal does not generate pom for modules

I'm running a multi-module maven project and have an unexpected behavior. First time I'm seeing this...
My parent module configures the install plugin, defining its classifier.
<plugin>
<artifactId>maven-install-plugin</artifactId>
<configuration>
<generatePom>true</generatePom>
<classifier>${env}</classifier>
</configuration>
</plugin>
<!-- ... -->
<modules>
<module>webapp-formation</module>
<module>db-formation</module>
</modules>
But when I'm running mvn install the .pom files are not generate for my modules. Only my parent is associated with a .pom file in my repositories. Thus trying to browse to my module's artifact on Archiva (after running mvn depoy of course!) it simply fails. I can browse to the parent but not its children.
So... I need to add the undocumented attribute generatePom to my plugin configuration to have the .pom files generated --copied would be a better word actually-- for all my modules. --I said undocumented attribute because this attribute is documented only for the install-file goal which is not the one ran by default. The install goal is not expecting that attribute...
Of course, if I do not configure my install plugin --so not configuring the classifier-- I have no problem and all .pom files are generated properly.
For you guys, is that a normal behavior? Something that you have already seen? Or should I just file a bug?
Thanks,
Olivier.
What you describe as an undocumented attribute is simply wrong, cause the attributes are specific on a goal base which means the given configuration will not change anything, cause the generatePom attribute is only valid for install-file goal. So you can remove it.
In general such configuration does not make sense, cause if you have different environments you should go a different way. Just removed hte configuration with <classifier>${env}</classifier> as well and try to deploy via:
mvn clean deploy

Wro4j maven plugin - required class is missing

I'm trying to run wro4j maven plugin according to the documentation
I add the plugin to my pom.xml:
<plugin>
<groupId>ro.isdc.wro4j</groupId>
<artifactId>wro4j-maven-plugin</artifactId>
<version>1.5.0</version>
</plugin>
and run the goal:
mvn wro4j:run -Dminimize=true -DtargetGroups=all
However the build fails with error:
org.apache.maven.lifecycle.LifecycleExecutionException: Internal error in the pl
ugin manager executing goal 'ro.isdc.wro4j:wro4j-maven-plugin:1.5.0:run': Unable
to load the mojo 'ro.isdc.wro4j:wro4j-maven-plugin:1.5.0:run' in the plugin 'ro
.isdc.wro4j:wro4j-maven-plugin'. A required class is missing: org/codehaus/plexu
s/util/Scanner
Do you know how to avoid this error?
Since wro4j-1.5.0, the maven 3.0 is required to run the plugin. The reason is a feature called incremental build support which depends on a library which is not available on older version of maven by default.
The issue is on your local environment.
Go to this folder on my windows machine:${user.home}/.m2/repository, then delete everything in this folder. (Well you can keep a copy.)
After deleting, run the Maven command:mvn clean install -U.
See: https://groups.google.com/forum/#!topic/wro4j/ZPSFBQ_5lI8

Why is the maven project info reports plugin creating a superfluous folder?

When I run mvn site, the maven-project-info-reports-plugin is creating a folder in my project base folder called "${project.basedir}". My plugin is defined like so with no extra configuration:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>${version.maven-project-info-reports-plugin}</version>
</plugin>
When this happens, the site generation gives me a warning:
[WARNING] The repository url 'file://${project.basedir}' is invalid -
Repository 'studio.repository' will be blacklisted.
Why is this oddly-named folder being created, and how can I prevent it from being created? What other configuration can I look at that might be related to this plugin?
UPDATE (the plugin is version 2.2, the latest as far as I know as of this writing)
There is a (dated) discussion in maven mailing list which looks related. The issue seems to be due to using repository mirrors.
You would want to try with the latest version of the plugin, as well as the workaround suggested, which is to set <dependencyLocationEnabled> to false.

Resources