There is no compilation error, but the moment I try to build it using maven it throws the following error and fails the build
I'm using Java 11 Open JDK
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project notification-functionapp: Compilation failure
[ERROR] MailSender.java:[112,37] cannot access javax.activation.DataSource
[ERROR] class file for javax.activation.DataSource not found
At 112 line of MailSender.java this following line of code is there
final Multipart multipart = new MimeMultipart("alternative");
javax.activation seems to be not present inherently in Java 11 Open JDK, so if you encounter this error please add the following dependency in you pom.xml or build.gradle
Maven
<dependency>
<groupId>com.sun.activation</groupId>
<artifactId>javax.activation</artifactId>
<version>1.2.0</version>
</dependency>
Gradle
compile 'com.sun.activation:javax.activation:1.2.0'
Related
We are planning to upgrade our AEM from 6.5.2 to 6.5.5 through service pack: https://docs.adobe.com/content/help/en/experience-manager-65/release-notes/service-pack/sp-release-n....
While following the instruction, I installed the 6.5.5 package and then updated pom.xml to update uber jar to 6.5.5. I can see those changes in my project.
But when I try to compile and build the project I get below error:
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /Users/mukmayu/All_Documents/Project_Official/Manulife_CEA/Code_Workspaces/AEMCodeAll/aem-global/core/src/main/java/ca/manulifeglobal/core/util/AssetAccessUtils.java:[99,7] cannot access org.apache.poi.ooxml.POIXMLDocument
class file for org.apache.poi.ooxml.POIXMLDocument not found
[ERROR] /Users/mukmayu/All_Documents/Project_Official/Manulife_CEA/Code_Workspaces/AEMCodeAll/aem-global/core/src/main/java/ca/manulifeglobal/core/util/AssetAccessUtils.java:[132,19] cannot access org.apache.poi.ooxml.POIXMLDocumentPart
class file for org.apache.poi.ooxml.POIXMLDocumentPart not found
[ERROR] /Users/mukmayu/All_Documents/Project_Official/Manulife_CEA/Code_Workspaces/AEMCodeAll/aem-global/core/src/main/java/ca/manulifeglobal/core/util/AssetAccessUtils.java:[158,15] cannot find symbol
symbol: method write(java.io.ByteArrayOutputStream)
location: variable workbook of type org.apache.poi.xssf.usermodel.XSSFWorkbook
I have added dependency for poi in my project and did maven update..and now I see apache poi 4.0.1...but issue reamains.
Any suggestion...?
Could you please try to include below dependency in your project
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.2.2</version>
</dependency>
In my maven plugin Mojo Java file, I am importing interface BuildPluginManager using following line:
import org.apache.maven.plugin.BuildPluginManager;
This line gives following error:
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /Users/username/git/path/to/plugin/my-maven-plugin/src/main/java/com/company/product/repo/my_maven_plugin/ExecutorExampleMojo.java:[25,31] cannot find symbol
symbol: class BuildPluginManager
location: package org.apache.maven.plugin
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
Also, eclipse shows this error in the beginning of the file:
The type org.apache.maven.plugin.BuildPluginManager cannot be resolved. It is indirectly referenced from required .class files
From what I understand, it means that the dependency jar/war that has this interface BuildPluginManager is not there in the POM file. My question is, which dependency do I need to pull in to use this interface? How do I find that dependency?
You need to include dependency on org.apache.maven:maven-core:
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>3.2.5</version>
</dependency>
You can find this out by searching the Maven Central Repository, By Classname.
Just put org.apache.maven.plugin.BuildPluginManager into the Classname input field.
I have created a very simple Maven project that builds a .war file. Maven version 3.2.3, Java version 1.7.0_67. The pom.xml file is in this gist.
If I run mvn clean install, then the project builds fine. But if I first download all dependencies with mvn dependency:resolve and mvn dependency:resolve-plugins, then run mvn -o install to build offline, I get an error like the following.
[INFO] --- maven-resources-plugin:2.7:resources (default-resources) # docker-restaesy-1 ---
[WARNING] The POM for org.apache.maven:maven-plugin-api:jar:2.2.1 is missing, no dependency information available
[WARNING] The POM for org.apache.maven:maven-project:jar:2.2.1 is missing, no dependency information available
[WARNING] The POM for org.apache.maven:maven-core:jar:2.2.1 is missing, no dependency information available
[WARNING] The POM for org.apache.maven:maven-artifact:jar:2.2.1 is missing, no dependency information available
[WARNING] The POM for org.apache.maven:maven-settings:jar:2.2.1 is missing, no dependency information available
[WARNING] The POM for org.apache.maven:maven-model:jar:2.2.1 is missing, no dependency information available
[WARNING] The POM for org.apache.maven:maven-monitor:jar:2.2.1 is missing, no dependency information available
[WARNING] The POM for org.codehaus.plexus:plexus-utils:jar:3.0.15 is missing, no dependency information available
[WARNING] The POM for org.apache.maven.shared:maven-filtering:jar:1.2 is missing, no dependency information available
[WARNING] The POM for org.codehaus.plexus:plexus-interpolation:jar:1.19 is missing, no dependency information available
[WARNING] Error injecting: org.apache.maven.shared.filtering.DefaultMavenResourcesFiltering
java.lang.NoClassDefFoundError: Lorg/sonatype/plexus/build/incremental/BuildContext;
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2436)
at java.lang.Class.getDeclaredFields(Class.java:1806)
at com.google.inject.spi.InjectionPoint.getInjectionPoints(InjectionPoint.java:661)
at com.google.inject.spi.InjectionPoint.forInstanceMethodsAndFields(InjectionPoint.java:366)
at com.google.inject.internal.ConstructorBindingImpl.getInternalDependencies(ConstructorBindingImpl.java:165)
at com.google.inject.internal.InjectorImpl.getInternalDependencies(InjectorImpl.java:609)
at com.google.inject.internal.InjectorImpl.cleanup(InjectorImpl.java:565)
...
Caused by: java.lang.ClassNotFoundException: org.sonatype.plexus.build.incremental.BuildContext
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:259)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:235)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:227)
...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.544 s
[INFO] Finished at: 2014-12-09T23:24:57+00:00
[INFO] Final Memory: 9M/303M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.7:resources (default-resources) on project docker-restaesy-1: Execution default-resources of goal org.apache.maven.plugins:maven-resources-plugin:2.7:resources failed: A required class was missing while executing org.apache.maven.plugins:maven-resources-plugin:2.7:resources: Lorg/sonatype/plexus/build/incremental/BuildContext;
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.apache.maven.plugins:maven-resources-plugin:2.7
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/root/.m2/repository/org/apache/maven/plugins/maven-resources-plugin/2.7/maven-resources-plugin-2.7.jar
[ERROR] urls[1] = file:/root/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.15/plexus-utils-3.0.15.jar
[ERROR] urls[2] = file:/root/.m2/repository/org/apache/maven/shared/maven-filtering/1.2/maven-filtering-1.2.jar
[ERROR] urls[3] = file:/root/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.19/plexus-interpolation-1.19.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
I diff the .m2/repository folder created from the two ways, the one created with dependency plugin is missing many files, most of them related to plexus.
So why doesn't the dependency plugin resolve all the dependencies? Am I doing something wrong here? Thanks
Edit
I get the same error with mvn dependency:go-offline
I understand this is too late but posting this answer if it help someone.
java.lang.ClassNotFoundException: clearly means that jar for org.sonatype.plexus.build.incremental.BuildContext is
not available
available but in wrong path
jar is corrupt
jar responsible for this class is plexus-build-api-0.0.4.jar
check your build output and see which path mvn is looking for this jar.
as an example I have below line in my output
/Users/akash/.m2/repository/org/sonatype/plexus/plexus-build-api/0.0.4/
In my case jar plexus-build-api-0.0.4.jar was corrupt in this path.
I checked with $jar -tbv , it it do not return class names , then its corrupt
I downloaded it from link and worked form me.
In your case you do not have this path so you will have to re-create project/reinstall plugins.
you can also try to create this path manually, download jars from linklink and see if it works.
I deleted my ~/.m2/repository and did a mvn clean install -P bootstrap on commit #371aad08ac93efa2 (master) cloned from https://github.com/spring-projects/spring-security-oauth. It could not get pass javadoc "phase" and threw up with. I used JDK 1.7.0_65 in Linux and Windows. I could compile the project with my old ~/.m2/repository before.
What am I missing here? Thanks
....
[ERROR] javadoc: warning - Class Autowired not found.
[ERROR] javadoc: warning - Class Autowired not found.
[ERROR]
[ERROR] Command line was:/Library/Java/JavaVirtualMachines/jdk1.7.0_65.jdk/Contents/Home/jre/../bin/javadoc #options #packages
[ERROR]
[ERROR] Refer to the generated Javadoc files in '~/workspace/spring-security-oauth/spring-security-oauth/target/apidocs' dir.
[ERROR] -> [Help 1]
I fixed the problem by adding version tag to 2.9.1 to maven-javadoc-plugin in <project_root>/pom.xml line 187 following #DaveSyer solution i.e.
<groupId>org.apache.maven.plugins</groupId> <!-- added for completeness -->
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version> <!-- fix version instead of getting the latest version, 2.10 -->
I am working on a web app project written in Java (1.6) using Eclipse IDE (3.6), and have decided to use Jetty (8.0.4) as the web server and servlet container. I am using maven (2) for dependency and build management. To get started, I decided to write a simple test application to make sure I had things working end-to-end. This is working fine, and I am able to start up the server and create some simple servlets. However, the source and Javadoc jars were not downloaded by maven, so when the mouse hovers over method names or classes, no documentation is found. It just reports the following:
Open Declaration javax.servlet.http.HttpServletResponse
Note: This element neither has attached source nor attached Javadoc and hence no Javadoc could be found.
I've searched for how to do this, and all I could find was this page on the Eclipse website describing how to configure maven to download the source modules as well. It says that the source module jars have the same name as the binary jars, with the suffix "-sources". I added source module dependencies to my maven config for each binary module, like so:
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>${jettyVersion}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server-sources</artifactId>
<version>${jettyVersion}</version>
</dependency>
However, maven failed to find the source module dependencies:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Jetty Servlet Example 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://repo1.maven.org/maven2/org/eclipse/jetty/jetty-server-sources/8.0.4.v20111024/jetty-server-sources-8.0.4.v20111024.pom
[WARNING] The POM for org.eclipse.jetty:jetty-server-sources:jar:8.0.4.v20111024 is missing, no dependency information available
Downloading: http://repo1.maven.org/maven2/org/eclipse/jetty/jetty-servlet-sources/8.0.4.v20111024/jetty-servlet-sources-8.0.4.v20111024.pom
[WARNING] The POM for org.eclipse.jetty:jetty-servlet-sources:jar:8.0.4.v20111024 is missing, no dependency information available
Downloading: http://repo1.maven.org/maven2/org/eclipse/jetty/jetty-util-sources/8.0.4.v20111024/jetty-util-sources-8.0.4.v20111024.pom
[WARNING] The POM for org.eclipse.jetty:jetty-util-sources:jar:8.0.4.v20111024 is missing, no dependency information available
Downloading: http://repo1.maven.org/maven2/org/eclipse/jetty/jetty-server-sources/8.0.4.v20111024/jetty-server-sources-8.0.4.v20111024.jar
Downloading: http://repo1.maven.org/maven2/org/eclipse/jetty/jetty-servlet-sources/8.0.4.v20111024/jetty-servlet-sources-8.0.4.v20111024.jar
Downloading: http://repo1.maven.org/maven2/org/eclipse/jetty/jetty-util-sources/8.0.4.v20111024/jetty-util-sources-8.0.4.v20111024.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.098s
[INFO] Finished at: Sun Apr 15 15:42:59 PDT 2012
[INFO] Final Memory: 5M/180M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project hello-world: Could not resolve dependencies for project org.example:hello-world:jar:0.1-SNAPSHOT: The following artifacts could not be resolved: org.eclipse.jetty:jetty-server-sources:jar:8.0.4.v20111024, org.eclipse.jetty:jetty-servlet-sources:jar:8.0.4.v20111024, org.eclipse.jetty:jetty-util-sources:jar:8.0.4.v20111024: Could not find artifact org.eclipse.jetty:jetty-server-sources:jar:8.0.4.v20111024 in central (http://repo1.maven.org/maven2) -> [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/DependencyResolutionException
Any pointers on how to configure maven to download the Jetty sources and javadocs?
Try to recreate your Eclipse project with this Maven command:
mvn eclipse:eclipse -DdownloadSources=true -DdownloadJavadocs=true
Another option is to update your pom.xml:
<plugin>
<artifactId>org.eclipse.jetty</artifactId>
<version>${jettyVersion}</version>
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
</configuration>
</plugin>
Both solutions only work if the source and javadocs were provided to the repo you're downloading from.
In your case (and your version) it should work because you can find the sources.jar in the Jetty repository.