Error in opening zip file error with maven command - maven

I executed this command
mvn compile exec:java -Dexec.classpathScope=compile -Dexec.mainClass=trident.MyClass
and got this
error: error reading ~/.m2/repository/com/google/guava/guava/13.0/guava-13.0.jar;
error in opening zip file error: error reading ~/.m2/repository/com/fasterxml
/jackson/core/jackson-core/2.0.0/jackson-core-2.0.0.jar; error in opening zip file
error:
error reading ~/.m2/repository/org/twitter4j/twitter4j-core/3.0.3/twitter4j-
core-3.0.3.jar; error in opening zip file
I'm new in maven and this is a part of Pom
<repository>
<id>twitter4j.org</id>
<name>twitter4j.org Repository</name>
<url>http://twitter4j.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
I'm sorry for parting code of POM file because i got message for mostly code and should add details
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>org.twitter4j</groupId>
<artifactId>twitter4j-core</artifactId>
<version>3.0.3</version>
</dependency>
<dependency>
<groupId>org.twitter4j</groupId>
<artifactId>twitter4j-stream</artifactId>
<version>3.0.3</version>
</dependency>
</dependencies>
and this part of POM file
<build>
<resources>
<resource>
<directory>${basedir}</directory>
<includes>
<include>twitter4j.properties</include>
<include>config.properties</include>
</includes>
</resource>
</resources>
Error i got when i extracted one of these jar file
End-of-central-directory signature not found. Either this file is not a zipfile, or it
constitutes one disk of a multi-part archive. In the latter case the central directory
and zipfile comment will be found on the last disk(s) of this archive. zipinfo: cannot
find zipfile directory in one of ~/.m2/repository/com/google/guava/guava/13.0/guava-
13.0.jar ~/.m2/repository/com/google/guava/guava/13.0/guava-13.0.jar.zip, and cannot
find ~/.m2/repository/com/google/guava/guava/13.0/guava-13.0.jar.ZIP, period
Warning that appeared with error
[WARNING] POM for 'com.google.guava:guava:pom:13.0:provided' is invalid. Its
dependencies (if any) will NOT be available to the current build. [WARNING] POM for
'com.fasterxml.jackson.core:jackson-core:pom:2.0.0:compile' is invalid. Its
dependencies (if any) will NOT be available to the current build. [WARNING] POM for
'org.twitter4j:twitter4j-core:pom:3.0.3:compile' is invalid. Its dependencies (if any)
will NOT be available to the current build. [WARNING] POM for 'org.twitter4j:twitter4j-
stream:pom:3.0.3:compile' is invalid.

It seems as though the jar file is corrupted - you can manually remove it (rm ~/.m2/repository/com/google/guava/guava/13.0/guava-13.0.jar), and maven will re-download it for you when you run mvn install.

Add the repository tag in POM file.And Run As Maven Build
<repositories>
<repository>
<id>central</id>
<name>Central Repository</name>
<url>https://repo1.maven.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>

Related

maven - anypoint studio fails to load a maven module inside a mule project

I've created a custom Mule extension, and I wanted to test it by loading it into a mule demo project as a mule-plugin.
I'm using Anypoint Studio 7.9.0, I have Maven 3.6.3 installed.
I run mvn clean package to create the .jar of my custom mule extension, and then mvn clean install to install it into my local Maven repository.
When I go to {mule demo project} -> Manage Dependencies -> Manage Modules -> Add module from Maven and try to add my custom mule extension to the mule demo project in which I want to test it, I get this error: Failed to resolve module {groupID}:{module name}
Frankly, I'm stuck here for some time now, and cannot figure out what I'm missing.
Here's the pom.xml of my custom mule extension:
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>custom-mule-extension</artifactId>
<version>0.1.1</version>
<packaging>mule-extension</packaging>
<name>Custom Mule Extension</name>
<parent>
<groupId>org.mule.extensions</groupId>
<artifactId>mule-modules-parent</artifactId>
<version>1.1.3</version>
</parent>
<dependencies>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.14.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.12.5</version>
</dependency>
</dependencies>
And this is the pom.xml of my mule demo application:
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>elastic-demo</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>mule-application</packaging>
<name>elastic-demo</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<app.runtime>4.3.0-20210322</app.runtime>
<mule.maven.plugin.version>3.5.1</mule.maven.plugin.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.0</version>
</plugin>
<plugin>
<groupId>org.mule.tools.maven</groupId>
<artifactId>mule-maven-plugin</artifactId>
<version>${mule.maven.plugin.version}</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.mule.connectors</groupId>
<artifactId>mule-sockets-connector</artifactId>
<version>1.2.2</version>
<classifier>mule-plugin</classifier>
</dependency>
<dependency>
<groupId>org.mule.connectors</groupId>
<artifactId>mule-http-connector</artifactId>
<version>1.5.25</version>
<classifier>mule-plugin</classifier>
</dependency>
<dependency>
<groupId>com.mycompany</groupId>
<artifactId>custom-mule-extension</artifactId>
<version>0.1.1</version>
<classifier>mule-plugin</classifier>
</dependency>
</dependencies>
<repositories>
<repository>
<id>anypoint-exchange-v2</id>
<name>Anypoint Exchange</name>
<url>https://maven.anypoint.mulesoft.com/api/v2/maven</url>
<layout>default</layout>
</repository>
<repository>
<id>mulesoft-releases</id>
<name>MuleSoft Releases Repository</name>
<url>https://repository.mulesoft.org/releases/</url>
<layout>default</layout>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>mulesoft-releases</id>
<name>MuleSoft Releases Repository</name>
<layout>default</layout>
<url>https://repository.mulesoft.org/releases/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
The custom-mule-extension <dependency> element is the one that cannot be resolved. As you can see from the snippet above, I inserted the dependency directly into the pom.xml file after the "Add modules" way from Anypoint Studio UI failed. And here, I get the error that the module cannot be resolved.
One thing that bothers me is: when I launch the mvn clean install -DskipTests command, there is one [INFO] log that doesn't look good, and it's the one saying No primary artifact to install, installing attached artifacts instead.
The build goes fine, and the dependency pops up into my local maven repository, but then I cannot add it to the mule demo project.
Any help or advice would be much appreciated.
Thanks in advance.

Could not find artifact com.wavefront:wavefront-spring-boot-bom:pom:2.1.1-SNAPSHOT

I am using spring-cloud-sleuth-otel-autoconfigure dependency for distributed tracing. Getting error while mvn clean install -X
Actual error message is Could not find artifact com.wavefront:wavefront-spring-boot-bom:pom:2.1.1-SNAPSHOT in xxxxSnapshots i am using settings.xml file in inside .m2 folder.
i tried to exclude these wavefront-spring-boot-bom dependency. but iam not able to see the mvn dependency:tree bcs of build failure. This is the repo link..https://repo.grails.org/grails/core/org/springframework/cloud/spring-cloud-sleuth-otel-dependencies/1.0.0-M7/
and this is excactly what i added.
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-otel-autoconfigure</artifactId>
<version>1.0.0-M7</version>
<exclusions>
<exclusion>
<groupId>com.wavefront</groupId>
<artifactId>wavefront-spring-boot-bom</artifactId>
</exclusion>
</exclusions>
</dependency>
<repositories>
<repository>
<id>grails</id>
<name>grails</name>
<url>https://repo.grails.org/grails/core/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>grails-plugins</id>
<name>grails-plugins</name>
<url>https://repo.grails.org/grails/plugins</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
How can i fix this issue?
Could you please try the followings:
Go to https://start.spring.io and generate a project with sleuth
Follow the documentation and add Sleuth-OTel (exclude Brave)
Please use the official repo (see the docs above) instead of third -party ones
Two extra tips:
Use mvn verify instead of mvn clean install
OTel is still in Alpha, it is not meant to be used in production (that's why SLeuth-OTel is an incubator project)

spring-security-saml missing jar in repo

As per the instructions on http://projects.spring.io/spring-security-saml/, I have the following in my pom.xml:
<dependencies>
<dependency>
<groupId>org.springframework.security.extensions</groupId>
<artifactId>spring-security-saml</artifactId>
<version>1.0.0.RC2</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>http://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
When I execute mvn clean install -U, I receive the following error:
[ERROR] Failed to execute goal on project myproj: Could not resolve dependencies
for project com.acme.myproj:myproj:war:1.0.0-SNAPSHOT: Could not find artifact org.
springframework.security.extensions:spring-security-saml:jar:1.0.0.RC2 in spring
-milestones (http://repo.spring.io/milestone) -> [Help 1]
The repo is there at http://repo.spring.io/milestone/org/springframework/security/extensions/spring-security-saml/1.0.0.RC2/, but there is no .jar file.
The correct dependency to use is:
<dependency>
<groupId>org.springframework.security.extensions</groupId>
<artifactId>spring-security-saml2-core</artifactId>
<version>1.0.0.RELEASE</version>
</dependency>
The jar is available both in Maven Central and http://repo.spring.io/list/release/
The Spring SAML web will get fixed soon.

Maven :How to use local archiva repository in project?

Downloaded Apache Archiva and uploaded 10 Jar file on it now i want to use this Archiva repository in my pom.xml so these 10 jar download from the Archiva ..What all setting i have to do i made changes in my pom.xml file like below
<repository>
<id>internal</id>
<name>Archiva Managed Internal Repository</name>
<url>http://serverip:8888/archiva/repository/internal/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
Also added all jar in pom.xml file
<dependency>
<groupId>org.forum</groupId>
<artifactId>jforum</artifactId>
<version>2.3.5</version>
</dependency>
<dependency>
<groupId>org.imaging</groupId>
<artifactId>imaging</artifactId>
<version>01012005</version>
</dependency>
<dependency>
<groupId>org.jbosscaches</groupId>
<artifactId>jboss-logging-spi</artifactId>
<version>2.1.2.GA</version>
</dependency>
But i am getting
Missing artifact org.jbosscaches:jboss-transaction-api:jar:1.0.1.GA
What all i am missing?
I made the following changes it worked now
<url>http://ipaddress:8888/repository/internal/</url>

WSO2 BAM 2.0 libraries in Maven

I'm trying to replicate the KPIAgent example in the WSO2 BAM ALPHA2 release but using maven to get the libraries required for the project to run.
So I've defined the following dependencies:
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.bam.agent</artifactId>
<version>3.2.4</version>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.bam.data.publisher.util</artifactId>
<version>3.2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.bam.service</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>com.google.common.wso2</groupId>
<artifactId>google-collect</artifactId>
<version>1.0.0.wso2v2</version>
</dependency>
<dependency>
<groupId>libthrift.wso2</groupId>
<artifactId>libthrift</artifactId>
<version>0.5.wso2v1</version>
</dependency>
<dependency>
<groupId>commons-pool.wso2</groupId>
<artifactId>commons-pool</artifactId>
<version>1.5.0.wso2v1</version>
</dependency>
Along with them I've defined the WSO2 repository this way:
<repository>
<id>wso2-maven2-repository</id>
<name>WSO2 Maven2 Repository</name>
<url>http://dist.wso2.org/maven2</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</releases>
</repository>
The problem I have is that the remote pom file for http://dist.wso2.org/maven2/org/wso2/carbon/org.wso2.carbon.bam.agent/3.2.4/org.wso2.carbon.bam.agent-3.2.4.pom refers to
<parent>
<groupId>org.wso2.carbon</groupId>
<artifactId>data-agents</artifactId>
<version>3.2.4</version>
</parent>
Which doesn't exist.
I assume this happens due to a rearrangement of the component's sources which is not fully reflected in the repository just yet; thus causing this inconsistency.
Question is then, which set of dependencies should I use to use EventReceiver in order to publish my own Events?
Thanks in advance for your support.
Seems it is not in the repo as you have mentioned for some reason. Can you try installing the pom given below to your local repository and see whether it works.
http://pastebin.com/AcmR1xmW

Resources