It has been few weeks since I build anything in maven, and I just tried to build one of the projects and it gives me this error. I try with multiple project and they are throwing same error:
Execution default of goal org.codehaus.mojo:aspectj-maven-plugin:1.8:compile failed: Plugin org.codehaus.mojo:aspectj-maven-plugin:1.8 or one of its dependencies could not be resolved: Could not find artifact com.sun:tools:jar:15.0.2 at specified path /usr/local/Cellar/openjdk/15.0.2/libexec/openjdk.jdk/Contents/Home/../lib/tools.jar -> [Help 1]
How can I resolve this error? I can't even run mvn install -DskipTests or mvn package.
I am on JDK version 8.
Edit: here is my plugin from pom:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>${aspectj-maven-plugin.version}</version>
<configuration>
<complianceLevel>${java.version}</complianceLevel>
<source>${java.version}</source>
<target>${java.version}</target>
<showWeaveInfo>true</showWeaveInfo>
<verbose>true</verbose>
<aspectLibraries>
<dependency>
<groupId>com.jcabi</groupId>
<artifactId>jcabi-aspects</artifactId>
</dependency>
</aspectLibraries>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
java version = 1.8
aspectj-maven-plugin.version = 1.8
EDIT: I pull this project from the repo, which means it works on other people's computer/on jenkins. I believe this is something to do with my local computer. It also gives me same error if I use terminal.
I found the answer after more research. As #Michael Katt mentioned in the comment, my JAVA_HOME wasn't properly set up. When I did which java, it gave me /usr/bin/java, but when I did echo $JAVA_HOME, it gave me nothing.
So with help of other colleague, I did vi ~/.bash_profile and added export JAVA_HOME=$(/usr/libexec/java_home). Not exactly sure why, but it is something to do with matching it with my jdk in my project structure which has /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk...
I opened new shell and typed echo $JAVA_HOME and it gives me /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home. My project build/compiles now.
I am still not sure how $(/usr/libexec/java_home) translated to /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk...
Related
I've come across a project with a pom.xml file that contains the following
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
...
So, this pom.xml file contains what is suggested in the documentation.
But my IntelliJ IDE is telling me
Plugin 'org.apache.maven.plugins:maven-gpg-plugin:3.0.1' not found
I tried to update the Maven indices, but this did not fix the issue.
I can still do mvn clean install (provided I comment a section related to the documentation, but this is another, I think unrelated, issue).
Of course, I never used this plugin and I don't know what maven-gpg-plugin actually does (well, I think it's used for signing software). I just wanted to run this project that I found, but, at the same time, I would not like to run it with these errors.
The documentation of this plugin explains that gpg should be on the path.
Signs all of a project's attached artifacts with GnuPG.
You need to have previously configured the default key.
gpg also needs to be on the search path.
So, I realised that I had not installed manually GnuGP, and so that I didn't probably have gpg on the path. So, I thought I had to install it first, and that's what I did.
Here are the instructions on how to install it.
I am on a mac, so I tried to find a brew formula to install it - here it is. So, I did brew install --cask gpg-suite (and I have now gpg on the path), but this did not solve the problem.
Why am I having this problem, and how can I solve it?
try "Invalidate caches & Restart"!!
Is it possible to force any maven plugin to execute with VM arguments when I do mvn clean install?
More context
I have an old project that I try to mirgate to java 11. During this migration I had trouble with wadl-client-plugin and JAXB showing this error.
schema_reference: Failed to read schema document '...', because 'file' access is not allowed due to restriction set by the accessExternalSchema property.
When I run it like mvn clean install -Djavax.xml.accessExternalSchema=all it works. I need to include somehow -Djavax.xml.accessExternalSchema=all to the plugin execution when I run mvn clean install. I've checked wadl-client-plugin's docs and don't see anything about it. Is it possible to do it somehow in general way? Configuring local JVM is not an option neither as I cannot do it at all machines.
I finally found an answer here
properties-maven-plugin inside my pom did the trick.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0.0</version>
<executions>
<execution>
<id>set-additional-system-properties</id>
<goals>
<goal>set-system-properties</goal>
</goals>
</execution>
</executions>
<configuration>
<properties>
<property>
<name>javax.xml.accessExternalSchema</name>
<value>all</value>
</property>
</properties>
<outputFile/>
</configuration>
</plugin>
A project that was earlier on svn was recently moved to github after which i am facing this issue while creating a build. It fails to generate the build number with the below error
Failed to execute goal org.codehaus.mojo:buildnumber-maven-plugin:1.4:create (default) on project line-management: An error has occurred while checking scm status. Exception while executing SCM command. Error while executing command. Error while executing process. Cannot run program "svn" (in directory "D:\workspace\project_git\project_management"): CreateProcess error=2, The system cannot find the file specified -> [Help 1]
code of pom.xml
<scm>
<connection>scm:svn:http://some.svn.url/</connection>
</scm>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<doCheck>true</doCheck>
<doUpdate>false</doUpdate>
<timestampFormat>{0,date,"yyyyMMddHHmmss"}</timestampFormat>
<timestampPropertyName>buildNumVar</timestampPropertyName>
<shortRevisionLength>10</shortRevisionLength>
</configuration>
</plugin>
Your scm tag still contains the the connection string to your old svn repository.
You should provide the url of the new git repository here, for example <connection>scm:git:https://github.com/your-git-repo.git</connection>. For the details of the connection string, please check here.
When you install the svn program (tortoise for example) you need to check the command line option. By default, that option is disabled. That worked for me.
I just taken the project - I checkout this and I want to resolve all problems
one of the problems which I cannot to resolve
Error(s) found in manifest configuration (org.apache.felix:maven-bundle-plugin:2.3.7:bundle:default-bundle:package)
it refers to this row of pom.xml:
<plugin>
code around this row:
<build>
<plugins>
<plugin>
<groupId>com.squeakysand.jsp</groupId>
<artifactId>jsptld-maven-plugin</artifactId>
<configuration>
<shortName>ctc</shortName>
<processTagFiles>true</processTagFiles>
</configuration>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>//this row
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Include-Resource>
META-INF/${project.artifactId}-${project.version}.tld=${project.build.outputDirectory}/META-INF/${project.artifactId}-${project.version}.tld,
{maven-resources}
</Include-Resource>
<Sling-Bundle-Resources>
/META-INF/tags
</Sling-Bundle-Resources>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
Please, help me resolve this problem.
Old question but for future Google results.
The issue is an old version of maven-bundle-plugin, specifically 2.3.7. Updating the pom.xml to use the latest (currently 2.5.0) fixed the issue.
Open the maven console (see the chapter "Enabling the Maven Console" here: http://www.theserverside.com/news/1363817/Introduction-to-m2eclipse).
Project right click->Maven->Update Project
You will see the real manifest problem in error messages in m2e console. Then you can fix them.
This error also occurs if the files referenced in the Include-Resource tag are not found by Eclipse. E.g. if the files are generated during the build process and Eclipse cannot execute one of the build steps (because of a missing m2e connector for instance). In this case check the build process and install required m2e connectors if available.
I ran into a strange problem..
I work on a project that use the ProcessBuilder Class.
On my local machine (Java6 and Java7 tested) I can easily mvn clean install & mvn assembly:single the project without any errors. Now I want to let the project build by travis-ci and ran into to following error
error: no suitable constructor found for ProcessBuilder(String)
full log file here..
but the Javadoc for ProcessBuilder show me that constructor.
My .travis.yml looks like this
language: java
jdk:
- oraclejdk7
- openjdk6
- openjdk7
after_success:
- mvn assembly:single
Any ideas why the build fails on travis-ci?
Thanks, F481
Edit:
Locally I'm using Maven 3, like travis-ci too (travis doc: "Travis Java builder will use Maven 3 to build it.")
My pom.xml: https://github.com/MultiServerControl/MineControl/blob/master/pom.xml
And the java code of the first error: this.processBuilder = new ProcessBuilder("");
The full class is available here
Edit2:
I specified a source and target version for the maven compilation like this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
Now the build is working for JDK7: https://travis-ci.org/MultiServerControl/MineControl/jobs/5963859
But I don't get the reason for that behavior.. and I want to build the project for JDK 5,6 too.
How can I do that?
I specified the version of the maven compiler plugin and the source and target version for the compilation like this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
Now the build is working! Much thanks to NilsH who pushed me in the right direction.