I get Error reading assemblies: No assembly descriptors found when building my project. I'm trying to set permissions for my .sh files and exclude a nasty .jar file that makes my application crash...I don't think the problem is about that though....
My maven-assembly plugin is added like this in my pom.xml file:
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/main/assembly/src.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
My assembly descriptor looks like this:
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>my-assembly-descriptor</id>
<formats>
<format>jar</format>
<format>war</format>
</formats>
<fileSets>
<fileSet>
<directory>${project.build.directory}</directory>
<outputDirectory>${project.build.directory}</outputDirectory>
<includes>
<include>*.sh</include>
</includes>
<fileMode>0755</fileMode>
</fileSet>
</fileSets>
<dependencySets>
<dependencySet>
<excludes>
<exclude>spring-2.5.4.jar</exclude>
</excludes>
</dependencySet>
</dependencySets>
</assembly>
The structure in my project is:
Interface - src - main - assembly - src.xml
- pom.xml
When trying to do Run as -> Debug as -> and then in goal putting
assembly:single
I get the same error. I tried in console, with assembly:assembly, and I got nothing. I even tried to put a wrong path to my assembly descriptor, but the error didn't change. When putting ${basedir}/ before the path to my assembly descriptor, I get the same.
I have Ubuntu 10.10 Maverick Meerkat, and I'm working with Eclipse EE,...
Thanks!
I have been using version 2.3 of maven-assembly-plugin, but I believe the problem is the same: if the assembly configuration is declared inside an execution, it works from mvn package, but does not work from mvn assembly:assembly.
The solution I have found is to declare the configuration in the top-level configuration of the plugin, and keep the execution as small as possible:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.3</version>
<configuration>
<descriptors>
<descriptor>src/main/assembly/standalone.xml</descriptor>
</descriptors>
<finalName>standalone</finalName>
</configuration>
<executions>
<execution>
<id>standalone</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
It seems that you have configured the assembly plugin in <build>...<pluginManagement>...<plugins>. It should work if you configure the plugin in <build>...<plugins>.
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/main/assembly/src.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
I was also facing the same issue with below command
$mvn clean assembly:single
But below command worked for me
$mvn clean assembly:assembly
Related
I have below POM in my project.
mvn clean verify -P it
POM:
<build>
<pluginManagement>
<plugins>
.....
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-plugin.version}</version>
<configuration>
<skipTests>false</skipTests>
<excludes>
<exclude>**/*CucumberTests.java</exclude>
<exclude>**/IT*.java</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${maven-plugin.version}</version>
<executions>
<execution>
<id>integration-tests</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<skipTests>false</skipTests>
<testFailureIgnore>true</testFailureIgnore>
<excludes>
<exclude>none</exclude>
</excludes>
<includes>
<include>**/*CucumberTests.java</include>
<include>**/*IT.java</include>
</includes>
<systemPropertyVariables>
<it.server.port>${random.http.port}</it.server.port>
<it.jmx.port>${random.jmx.port}</it.jmx.port>
</systemPropertyVariables>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.5.9.RELEASE</version>
<executions>
<execution>
<id>pre-integration-test</id>
<goals>
<goal>start</goal>
</goals>
<configuration>
<skip>false</skip>
<wait>2000</wait>
<!-- Max retry count -->
<maxAttempts>180</maxAttempts>
<jmxPort>${random.jmx.port}</jmxPort>
<arguments>
<argument>--server.port=${random.http.port}</argument>
<argument>--spring.profiles.active=${spring.profile}</argument>
</arguments>
<jvmArguments>
-Djava.security.egd=file:///dev/urandom
</jvmArguments>
</configuration>
</execution>
<execution>
<id>post-integration-test</id>
<goals>
<goal>stop</goal>
</goals>
<configuration>
<skip>false</skip>
<jmxPort>${random.jmx.port}</jmxPort>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
...
</plugin>
</plugins>
</build>
Test class:
import org.junit.runner.RunWith;
import io.cucumber.junit.CucumberOptions;
import net.serenitybdd.cucumber.CucumberWithSerenity;
#RunWith(CucumberWithSerenity.class)
#CucumberOptions(
plugin = {"pretty"},
glue = {"my.stepdefinitions"},
tags = {"#Demo"},
features = "src/it/resources/features/"
)
public class MicroServiceCucumberTests {
}
path: src/it/java
Basically it trigger sure-fire and then startup the app and just stuck there without executing maven-failsafe-plugin:2.21.0:integration-test (integration-tests)
Versions are being used:
<serenity.plugin.version>2.4.34</serenity.plugin.version>
<serenity.version>2.4.34</serenity.version>
<serenity.cucumber.version>2.4.34</serenity.cucumber.version>
<cucumber.version>6.10.4</cucumber.version>
<maven-plugin.version>3.0.0-M5</maven-plugin.version>
<java.version>1.8</java.version>
After digging further into logs what I noticed was, app didn't start up properly and stuck with below logs
DEBUG] Application argument(s): --server.port=54110 --spring.profiles.active=it
[DEBUG] Connecting to local MBeanServer at port 54111
[DEBUG] Waiting for spring application to start...
[DEBUG] MBean server at port 54111 is not up yet...
[DEBUG] Spring application is not ready yet, waiting 2000ms (attempt 1)
[DEBUG] MBean server at port 54111 is not up yet...
[DEBUG] Spring application is not ready yet, waiting 2000ms (attempt 2)
This solution worked for me https://stackoverflow.com/a/65952986/2303693
Adding below within the spring-boot-maven-plugin in the POM did the trick.
<configuration>
<fork>false</fork>
</configuration>
However same code worked in iOS machine without above fix. Further still not sure what caused the issue in Windows.
So im working on this JavaFx application (Java 8) which copies a .xlsx file and fills it with data from a .txt-file, for this I use the apache poi dependency. I have successfully build a fat jar through the maven-assembly-plugin. Here my pom.xml:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<archive>
<manifest>
<mainClass>sample.Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.17</version>
</dependency>
</dependencies>
I build it with:
mvn clean compile assembly:single
The application and its dependencies work fine when I run the main.java in IntelliJ, also the built fat jar starts and works fine when I run it through IntelliJ (performes all functions without a problem).
Only when I start my fat jar outside of the IDE, through a cmd-file (to start the JavaFx application), I'm encountering problems. It starts and loads the .txt-file just fine, but at the point where it's supposed to use the dependency and create a worksheet the program does nothing. Here's what I run in .cmd-file:
start javaw -jar ExcelConverter-1.0-jar-with-dependencies.jar
I've tried building it with various other plugins (shade etc), all seem to have the same problem.
I've also tried building it through intelliJ as an artifact, same issue.
Dependency order is also not an issue as I only use one.
use maven shade plugin for this .check http://maven.apache.org/plugins/maven-shade-plugin/index.html.
below is the sample
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
The problem wasn't the plugins or dependencies not working but that the apache-poi dependency was too memory intensive and thus my JVM ran out of memory. The IntelliJ IDE I've installed uses JVM 64-bit by default, my system on the other hand was using a 32-bit version. I was able to update my JVM to 64 bit and getting it to work fine.
Failed to install artifact: C:\Test\7\config\analyzers\analyzers-7.0.0-13-SNAPSHOT-jar-with-dependencies.jar: org.osgi.framework.BundleException: The bundle file:/C:/Test/7/config/analyzers/analyzers-7.0.0-13-SNAPSHOT-jar-with-dependencies.jar does not have a META-INF/MANIFEST.MF! Make sure, META-INF and MANIFEST.MF are the first 2 entries in your JAR!
org.osgi.framework.BundleException: The bundle file:/C:/Palamida/7.0-v4/config/analyzers/analyzers-7.0.0-13-SNAPSHOT-jar-with-dependencies.jar does not have a META-INF/MANIFEST.MF! Make sure, META-INF and MANIFEST.MF are the first 2 entries in your JAR!
at org.apache.felix.fileinstall.internal.DirectoryWatcher.installOrUpdateBundle(DirectoryWatcher.java:1004)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:952)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:871)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:485)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:361)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:312)
The 1st part of the error claims there is no MANIFEST.MF but checking manually reveals it is there. The 2nd part of the error claims the MANIFEST.MF is not one of the 1st two entries in the jar which I have not been able to verify. Is there a configuration issue with my assembly plugin?
My pom.xml containing my maven-assembly-plugin config:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
I am also using maven-bundle-plugin with the manifest goal, which outputs a manifest.mf which is consumed by assembly-plugin, but I don't believe that should be causing any interference.
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<finalName>${name.project}</finalName>
<archive>
<manifest>
<mainClass>br.com.car.view</mainClass>
</manifest>
<manifestFile>${basedir}/META-INF/MANIFEST.MF</manifestFile>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
Way to use manifest command File in your maven (pom) configuration file
I am in Eclipse environment. I want LESS to compile only when explicitly invoked via mvn package. At the moment, as soon as I make any changes in my less file it propagates the change to CSS. What should I do to avoid this behaviour?
<plugin>
<groupId>org.lesscss</groupId>
<artifactId>lesscss-maven-plugin</artifactId>
<version>1.7.0.1.1</version>
<configuration>
<watch>false</watch>
<sourceDirectory>src/main/webapp/css</sourceDirectory>
<outputDirectory>src/main/webapp/css</outputDirectory>
<compress>true</compress>
<force>true</force>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
</plugin>
also posted this issue here
As a workaround I have encapsulated LESS plugin inside a profile. On server side I invoke that profile to do LESS compilation
mvn package -pless_compile
M2Eclipse is an Eclipse plugin which provides tight integration for Maven. It determines who and when plugins should be executed. Each plugin can store lifecycle mapping metadata with data on which it based its decision (see M2E compatible maven plugins). By default this plugin is called on incremental builds:
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<goals>
<goal>compile</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute>
<runOnIncremental>true</runOnIncremental>
<runOnConfiguration>false</runOnConfiguration>
</execute>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
If you want to disable automatic compilation, then you need to add the following entry to your pom.xml:
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.lesscss</groupId>
<artifactId>lesscss-maven-plugin</artifactId>
<versionRange>[0,)</versionRange>
<goals>
<goal>compile</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
You need to define in which maven phase you want to execute your plugin, basically adding the phase tag under the execution tag. Take look to the following examples: http://maven.apache.org/guides/mini/guide-configuring-plugins.html#Using_the_executions_Tag.
How I can configure copy-flex-resources goal and swf dependencies to copy swf files to the custom folder in my web-app? By default it copies to the web-app root.
More about copy-flex-resources goal here:
https://docs.sonatype.org/display/FLEXMOJOS/Copy+Flex+Resources
Your can add a "configuration" to that plugin:
<configuration>
<webappDirectory>${basedir}/src/main/webapp</webappDirectory>
<!-- If RSLs are coming from the WAR uncomment this line
<copyRSL>false</copyRSL>-->
</configuration>
I use maven-antrun-plugin to copy several swfs from several sub projects
(there's probably a better way, but it does the job)
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<move file="${project.build.directory}/${project.build.finalName}/mySwf-${project.version}.swf"
tofile="${project.build.directory}/${project.build.finalName}/somedir/mySwf.swf" />
</tasks>
</configuration>
</execution>
</executions>
</plugin>
For the war project the maven-dependency-plugin is the somewhat better choice. It can copy different resources to different places and keeps in sync with your versions declared in your dependencies.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.0</version>
<executions>
<execution>
<id>copy-content</id>
<phase>compile</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.foo.bar</groupId>
<artifactId>barstyles</artifactId>
<type>swf</type>
<outputDirectory>${flashAppDir}/bar</outputDirectory>
<destFileName>barstyles.swf</destFileName>
</artifactItem>
<artifactItem>
<groupId>org.graniteds</groupId>
<artifactId>graniteds</artifactId>
<type>swf</type>
<outputDirectory>${flashAppDir}/thirdparty</outputDirectory>
<destFileName>graniteds.swf</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>