NoFileAssignedException exception when generating karaf feature with maven - maven

I have an error in my karaf feature project wher I run my mvn install. Here is the pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.dmasoft.karaf.example</groupId>
<artifactId>assemblies-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>com.dmasoft.karaf.example.feature</groupId>
<artifactId>dmasoft-feature</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>feature</packaging>
<name>${project.groupId}/${project.artifactId}:${project.packaging}:${project.version}</name>
<build>
<plugins>
<plugin>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
When I run my mvn clean install I get this error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install (default-install) on project dmasoft-feature: NoFileAssignedException: The packaging plugin for this project did not assign a main file to the project but it has attachments. Change packaging to 'pom'. -> [Help 1]

The maven-install-plugin:3.0.0-M1 was released as of 01/10/2018
Since, I got the same error with flexmojos projects where packaging was set to .
Solution is to set the version for the maven-install-plugin to the previous version (2.5.2) explicitly so it won't resolve the version automatically.
Note: I had to do this for the maven-deploy-plugin too. There may be others.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
</plugins>
</build>

Now you can change mule.tools.version to 1.7 1.7 instead of setting maven plugins version if you are using it.

Related

multi module maven release

i have a multi module maven project
the structure of the poms is workspace/parent , workspace/child1 ,workspace/child2
and in the svn repository i have one repository for all of them
when release:prepare executes , does not any problem, but when release:perform executes this error occurs
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-release-plugin:2.3.2:perform
(default-cli) on project veterans: Error executing Maven. Working
directory
"D:\java\myeclipse-workspace\veterans\target\checkout\veterans" does
not exist! -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to
execute goal
org.apache.maven.plugins:maven-release-plugin:2.3.2:perform
(default-cli) on project veterans: Error executing Maven.
i think the problem is the checkout from repository, because after checkout in the target folder we have trunk,tags,branches, but i think we must have parent,child1,child2
and other problem is, why when maven-release tags the snapshot, it tags the repository structure into svn repository tags?
after release:prepare we have trunk,branches,tags in svnrepository/tags/parent-1.0.0
this is my parent pom :
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.dpj</groupId>
<artifactId>veterans</artifactId>
<version>1.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<scm>
<connection>scm:svn:http://192.168.1.10:7075/svn/veterans/trunk</connection>
<developerConnection>scm:svn:http://192.168.1.10:7075/svn/veterans/trunk</developerConnection>
<url>http://192.168.1.10:7075/svn/veterans</url>
</scm>
<properties>
<jdk.version>1.7</jdk.version>
<maven.build.timestamp.format>yyyy-MM-dd</maven.build.timestamp.format>
<packname>-${project.version}-FL-${maven.build.timestamp}</packname>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<modules>
<module>../veterans-presentation</module>
<module>../veterans-service</module>
</modules>
<distributionManagement>
<repository>
<id>dpj-artifactory-releases</id>
<name>dpj-artifactory-releases</name>
<url>http://192.168.1.10:8082/artifactory/ext-release-local</url>
</repository>
<snapshotRepository>
<id>dpj-artifactory-snapshots</id>
<name>dpj-artifactory-snapshots</name>
<url>http://192.168.1.10:8082/artifactory/ext-snapshot-local</url>
</snapshotRepository>
</distributionManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin</artifactId>
<version>1.9.2</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<tagBase>http://192.168.1.10:7075/svn/veterans/tags/</tagBase>
<tagNameFormat>#{project.artifactId}-#{project.version}</tagNameFormat>
</configuration>
</plugin>
</plugins>
</build>
</project>
i solved my issue by adding the project name in end of connection and developerConnection. as though
when the plugin wants to add to tag, it sets the checkout to parent folder. So i added the address of repository of projects with the name of folder after trunk.
<connection>scm:svn:http://reposotpry:7075/svn/veterans/trunk/veterans/</connection>
<developerConnection>scm:svn:http://reposotpry:7075/svn/veterans/trunk/veterans/</developerConnection>
and its fixed.

POM 'org.apache.maven.plugins:maven-clean-plugin' not found in repository

When I try to build/clean/install with maven I get the error below. Maven 2 worked but didn't download a package into the .m2/repository/ so I tried uninstalling maven 2 (sudo apt-get remove maven2) and reinstalling (sudo apt-get install maven2), setting the local repository to a map of my choosing in settings.xml of the maven map but I must've done something wrong. Anyone that can help me out?
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).
Project ID: org.apache.maven.plugins:maven-clean-plugin
Reason: POM 'org.apache.maven.plugins:maven-clean-plugin' not found in repository: Unable to download the artifact from any repository
org.apache.maven.plugins:maven-clean-plugin:pom:2.3
from the specified remote repositories:
central (http://repo1.maven.org/maven2)
for project org.apache.maven.plugins:maven-clean-plugin
This is my POM.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>be.ugent.sop.p404</groupId>
<artifactId>P404</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>P404</name>
<build>
<plugins>
<!-- Set to compile using JDK 7 -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<!-- Avoid war plugin complaining missing web.xml -->
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
<modules>
<module>P404WAR</module>
<module>P404EJB</module>
<module>P404EAR</module>
</modules>
</project>
First check if maven is working or not after reinstalling
If it is working, there is chance that u downlaod a particular jar which needs credentials or proxy settings. Either define it in settings.xml or in pom.
remove all ur .m2 folder's repository and place settings.xml if neccessary
Its better if you share your pom.xml

How to Build Xcode build with Maven plugin

I'm trying to build Xcode app with maven plugin, i worte pom.xml as shown in below
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.yqlabsEnterprise.SampleMaven</groupId>
<artifactId>SampleMaven</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>xcode-lib</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<groupId>com.sap.prd.mobile.ios.mios</groupId>
<artifactId>xcode-maven-plugin</artifactId>
<version>1.14.0</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
</project>
i installed maven, and run with maven using terminal, but my app not build successfully, i got error
"Failed to execute goal com.sap.prd.mobile.ios.mios:xcode-maven-plugin:1.14.0:prepare-xcode-build (default-prepare-xcode-build) on project SampleMaven: Execution default-prepare-xcode-build of goal com.sap.prd.mobile.ios.mios:xcode-maven-plugin:1.14.0:prepare-xcode-build failed: A required class was missing while executing com.sap.prd.mobile.ios.mios:xcode-maven-plugin:1.14.0:prepare-xcode-build: Lorg/sonatype/aether/RepositorySystem"
will you please help me to solve this issue.
You'll need to downgrade to Maven 3.0.x since the plugin is not compatible with later versions of Maven. The reason is that the Java package org.sonatype.aether.* has been renamed to org.eclipse.aether.*.

Sonar does not run phpunit in zend project

I need to run sonar on a Zend project using maven.
Everything works fine except that Sonar ignores the unit tests completely and does not run them or show their results in the report.
No errors of any kind are reported in the log.
I am using:
PHPUnit 3.6,
Zend 1.11,
Sonar 3.7
here is my pom:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>quickstart</groupId>
<artifactId>quickstart</artifactId>
<name>quick start</name>
<version>1.0</version>
<!-- For the moment, specify pom as packaging for php projects -->
<packaging>pom</packaging>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>2.0</version>
</plugin>
</plugins>
</pluginManagement>
<sourceDirectory>${basedir}/web</sourceDirectory>
<testSourceDirectory>${basedir}/tests</testSourceDirectory>
</build>
<properties>
<sonar.projectKey>org.codehaus.sonar:quickstart</sonar.projectKey>
<sonar.projectName>PHP project quick start</sonar.projectName>
<sonar.projectVersion>1.0</sonar.projectVersion>
<sonar.language>php</sonar.language>
<sonar.sourceEncoding>UTF-8</sonar.sourceEncoding>
<sonar.dynamicAnalysis>false</sonar.dynamicAnalysis>
<excludesAppli>**/library/**</excludesAppli>
<sonar.exclusions>${excludesAppli}</sonar.exclusions>
<sonar.phpCodesniffer.argumentLine>--ignore=**/library/** </sonar.phpCodesniffer.argumentLine>
<sonar.phpDepend.argumentLine>--ignore=**\library\**</sonar.phpDepend.argumentLine>
<sonar.phpPmd.argumentLine>--exclude **\library\**</sonar.phpPmd.argumentLine>
<sonar.phpUnit.coverage.analyzeOnly>false</sonar.phpUnit.coverage.analyzeOnly>
<sonar.phpUnit.analyzeOnly>false</sonar.phpUnit.analyzeOnly>
<sonar.phpUnit.analyze.test.directory>true</sonar.phpUnit.analyze.test.directory>
<sonar.phpUnit.skip>false</sonar.phpUnit.skip>
<sonar.phpUnit.coverage.skip>false</sonar.phpUnit.coverage.skip>
<!--<sonar.phpUnit.mainTestClass></sonar.phpUnit.mainTestClass> -->
<!--<sonar.phpUnit.configuration>${basedir}/tests/phpunit.xml</sonar.phpUnit.configuration> -->
</properties>
any ideas what I am missing?
Solved I need to edit:
<sonar.dynamicAnalysis>false</sonar.dynamicAnalysis>
to
<sonar.dynamicAnalysis>true</sonar.dynamicAnalysis>

Dependency management does not work for multi-module project

I have a Maven project with multiple modules and I'm trying to set it up so that module dependencies are automatically built to the correct lifecycle phase needed for building depending modules to the requested lifecycle phase.
In the example, the module plugin builds a Maven plugin, which is used to generate source code and is used by the module main. If I just try to use mvn -am -pl main compile, the module plugin is compiled but the process-classes lifecycle phase is not executed (which is necessary for a plugin to be usable). Compiling the module main then fails then with the following error:
[ERROR] Failed to parse plugin descriptor for example:plugin:1.0.0-SNAPSHOT (/Users/ims/Dropbox/IMS/Projects/PARITy_R4/codegen-test-simple/plugin/target/classes): No plugin descriptor found at META-INF/maven/plugin.xml -> [Help 1]
Is Maven, or a plugin for it, capable of resolving the dependencies of modules in a multi-module project and build them to stage necessary by other modules? And if so, how do I need to set up the project for this to work?
These are the POMs of my project:
pom.xml:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<groupId>example</groupId>
<artifactId>project</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>plugin</module>
<module>main</module>
</modules>
</project>
plugin/pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<groupId>example</groupId>
<artifactId>plugin</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>maven-plugin</packaging>
<parent>
<groupId>example</groupId>
<artifactId>project</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.2</version>
<configuration>
<goalPrefix>configurator</goalPrefix>
</configuration>
<executions>
<execution>
<id>default-descriptor</id>
<goals>
<goal>descriptor</goal>
</goals>
<phase>process-classes</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
main/pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<groupId>example</groupId>
<artifactId>main</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<parent>
<groupId>example</groupId>
<artifactId>project</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<build>
<plugins>
<plugin>
<groupId>example</groupId>
<artifactId>plugin</artifactId>
<version>1.0.0-SNAPSHOT</version>
<executions>
<execution>
<goals>
<goal>codegen</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
If you look at the reference documentation for the Maven lifecycle, you'll see that compile is before process-classes.
If you want this step to happen, you need to use mvn -am -pl main process-classes instead.
But I suggest that you always use mvn ... install - it also runs the tests and makes sure that the plugin which main uses is actually the one you think it should: Without install, the build will use an old/outdated version from the local repository (Maven will not magically determine "oh, there is a plugin in my reactor, I'll use that instead of the version from the local repo").

Resources