Upon running the command — mvn clean -Dmaven.test.skip=true package -X
I am getting following error.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:3.1.2:jar (default-jar) on project my-module-one: Error assembling JAR: Could not create modular JAR file. The JDK jar tool exited with 1 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:3.1.2:jar (default-jar) on project my-module-one: Error assembling JAR
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error assembling JAR
at org.apache.maven.plugins.jar.AbstractJarMojo.createArchive (AbstractJarMojo.java:269)
at org.apache.maven.plugins.jar.AbstractJarMojo.execute (AbstractJarMojo.java:293)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.codehaus.plexus.archiver.ArchiverException: Could not create modular JAR file. The JDK jar tool exited with 1
at org.codehaus.plexus.archiver.jar.JarToolModularJarArchiver.postCreateArchive (JarToolModularJarArchiver.java:123)
at org.codehaus.plexus.archiver.AbstractArchiver.createArchive (AbstractArchiver.java:1013)
at org.apache.maven.archiver.MavenArchiver.createArchive (MavenArchiver.java:669)
at org.apache.maven.plugins.jar.AbstractJarMojo.createArchive (AbstractJarMojo.java:262)
at org.apache.maven.plugins.jar.AbstractJarMojo.execute (AbstractJarMojo.java:293)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :my-module-one
Here is my pom.xml for my-module-one module
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>my-module-one</artifactId>
<packaging>jar</packaging>
<parent>
<groupId>com.myparent</groupId>
<artifactId>my-parent</artifactId>
<version>0.1</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Here is pom.xml for parent
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.myparent</groupId>
<artifactId>my-parent</artifactId>
<version>0.1</version>
<packaging>pom</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.5.RELEASE</version>
<relativePath/>
<!-- lookup parent from repository -->
</parent>
<name>My App</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>11</java.version>
<lombok.version>1.18.8</lombok.version>
<rest.assured.version>4.0.0</rest.assured.version>
<maven.compiler.version>3.8.1</maven.compiler.version>
<spring-loaded.version>1.2.8.RELEASE</spring-loaded.version>
<start-class>com.myparent.main.Main</start-class>
</properties>
<modules>
<module>module-one</module>
<module>module-two</module>
<module>main</module>
</modules>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>${rest.assured.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.version}</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>springloaded</artifactId>
<version>${spring-loaded.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
P.S. Running the application directly using mvn spring-boot:run
works fine.
EDIT
There is one more line that comes up during the packaging of first module
jar: Package com.myparent.main missing from ModulePackages class file attribute
- Remove From My Forums
-
Question
-
I am using TFS 2010 and the Maven build extension. I have many working builds in place. I have a new one however that compiles source code but then fails when it tries to create a jar file. I have googled my fingers to the bone. Does
anyone have a suggestion? BTW, I can run a Maven build manually on the build server on top of the source pulled over by TFS, and the manual build works fine. Also, the jar that is read-only is created by the Maven build. (And it is read-only
when built with TFS and not read-only when built manually. I checked.)[INFO] Scanning for projects…
[INFO] ————————————————————————
[INFO] Building Services-Core
[INFO] task-segment: [install]
[INFO] ————————————————————————
[INFO] [resources:resources {execution: default-resources}]
[INFO] Using ‘UTF-8’ encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Compiling 23 source files to C:Builds7Services-Coretest4SourceswebWEB-INFclasses
[INFO] [resources:testResources {execution: default-testResources}]
[INFO] Using ‘UTF-8’ encoding to copy filtered resources.
[INFO] Copying 10 resources
[INFO] [compiler:testCompile {execution: default-testCompile}]
[INFO] Not compiling test sources
[INFO] [surefire:test {execution: default-test}]
[INFO] Tests are skipped.
[INFO] [jar:jar {execution: default-jar}]
[INFO] ————————————————————————
[ERROR] BUILD ERROR
[INFO] ————————————————————————
[INFO] Error assembling JAREmbedded error: C:Builds7Services-Coretest4SourcestargetServices-Core-1.0.0.jar is read-only.
[INFO] ————————————————————————
[INFO] For more information, run Maven with the -e switch
[INFO] ————————————————————————
[INFO] Total time: 3 seconds
[INFO] Finished at: Wed Feb 08 23:21:35 GMT 2012
[INFO] Final Memory: 18M/45M
[INFO] ————————————————————————
AJ_3
-
Edited by
Wednesday, February 8, 2012 11:56 PM
-
Moved by
Vicky SongMicrosoft employee
Friday, February 10, 2012 2:41 AM
(From:Team Foundation Server — Build Automation)
-
Edited by
-
Type:
Bug
-
Status:
Closed -
Priority:
Major -
Resolution:
Not A Problem
-
Affects Version/s:
2.3
-
Fix Version/s:
None
-
Component/s:
None
-
Environment:
Windows 7
maven 3.0.2
When I try to run ‘package’ on a multi-module project one of the modules fails. The only difference on this module being it will run an ant script so no jar, or an empty one up until now, would be generated.
Plugin 2.2 will do the job. Plugin 2.3 fails on ‘-X package’ with:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.3.1:jar (default-jar) on project ETRAMPackager: Error assembling JAR: Negative time -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.3.1:jar (default-jar) on project ETRAMPackager: Error assembling JAR at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:534) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) at org.apache.maven.cli.MavenCli.main(MavenCli.java:141) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352) Caused by: org.apache.maven.plugin.MojoExecutionException: Error assembling JAR at org.apache.maven.plugin.jar.AbstractJarMojo.createArchive(AbstractJarMojo.java:223) at org.apache.maven.plugin.jar.AbstractJarMojo.execute(AbstractJarMojo.java:235) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) ... 19 more Caused by: java.lang.IllegalArgumentException: Negative time at java.io.File.setLastModified(File.java:1258) at org.codehaus.plexus.components.io.resources.PlexusIoFileResource.setLastModified(PlexusIoFileResource.java:148) at org.codehaus.plexus.components.io.resources.PlexusIoFileResource.setFile(PlexusIoFileResource.java:82) at org.codehaus.plexus.components.io.resources.PlexusIoFileResource.<init>(PlexusIoFileResource.java:73) at org.codehaus.plexus.components.io.resources.PlexusIoFileResourceCollection.addResources(PlexusIoFileResourceCollection.java:144) at org.codehaus.plexus.components.io.resources.PlexusIoFileResourceCollection.getResources(PlexusIoFileResourceCollection.java:181) at org.codehaus.plexus.components.io.resources.AbstractPlexusIoResourceCollection.getLastModified(AbstractPlexusIoResourceCollection.java:247) at org.codehaus.plexus.archiver.AbstractArchiver.isUptodate(AbstractArchiver.java:768) at org.codehaus.plexus.archiver.AbstractArchiver.checkForced(AbstractArchiver.java:799) at org.codehaus.plexus.archiver.zip.AbstractZipArchiver.execute(AbstractZipArchiver.java:236) at org.codehaus.plexus.archiver.AbstractArchiver.createArchive(AbstractArchiver.java:852) at org.apache.maven.archiver.MavenArchiver.createArchive(MavenArchiver.java:543) at org.apache.maven.plugin.jar.AbstractJarMojo.createArchive(AbstractJarMojo.java:216) ... 22 more [ERROR] [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http:[ERROR] [ERROR] After correcting the problems, you can resume the build with the command [ERROR] mvn <goals> -rf :ETRAMPackager
Я добавляю сборку maven/tycho в проект плагина eclipse с открытым исходным кодом Markdown Editor
Я сделал то же, что и для нескольких других проектов: добавил pom.xml для родительского, подключаемого и функционального проектов. (Ссылка на источники выше, типичный 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>
<parent>
<groupId>com.winterwell.markdown</groupId>
<artifactId>parent</artifactId>
<version>0.2.3</version>
</parent>
<artifactId>winterwell.markdown</artifactId>
<version>0.2.3</version>
<packaging>eclipse-plugin</packaging>
<name>markdown-editor</name>
<description>Markdown Editor Plugin for Eclipse</description>
<build>
<sourceDirectory>src</sourceDirectory>
</build>
</project>
Однако mvn package
дать несколько неуместную ошибку:
[ОШИБКА] Не удалось выполнить цель org.eclipse.tycho:tycho-packaging-plugin:0.18.1:package-plugin (default-package-plugin) в проекте winterwell.markdown: ошибка сборки JAR: ZIP-файл не может включать себя — > [Помощь 1]
Для любых zip-файлов нет определений.
Я внимательно посмотрел на проект, и единственная разница, которую я вижу, это то, что он имеет некоторые зависимости .jar в папке lib.
В чем может быть настоящая проблема со сборкой maven/tycho?
ошибка упаковки maven
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.4:jar (default-jar) on project xxxx: Error assembling JAR: com/example/C:UsersAdministratorAppDataRoamingSubversion not found. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Анализ причин:
При переходе с Win10 на Mac конфигурация идеи напрямую экспортируется, а затем импортируется в версию идеи для Mac. Конфигурация версии для Win и версии для Mac немного отличается. В проекте используется svn в качестве инструмента контроля версий, код напрямую копируется из win10, и указанная выше ошибка сообщается при использовании maven для сборки военного пакета. Решение состоит в том, чтобы убрать галочку напротив Использовать настраиваемый каталог конфигурации Subversion и изменить его на значение по умолчанию.