I'm trying to use Android 4.4_r1 and Maven for a project but for some reason the version maxima maven let me use is 4.1.1.4
I know it is not possible redristribucion android.jar and therefore the necessary maven-android-sdk-deployer, I've cloned the project and have run the command
mvn clean install -Pall,with-javadoc
and install all libraries, later when i edit the pom.xml file i get the following error
Missing artifact com.google.android:android:jar:4.4_r1
I've checked into the path ~/.m2/repository/com/google/android/android and i can see the following versions
1.5_r4 2.2.1 2.3.1 4.1.1.4 4.2.2_r2 4.3_r2 4.4 4.4_r1
What am I doing wrong?
From https://github.com/mosabua/maven-android-sdk-deployer -
The android.jar artifacts in Maven central are available with the
groupId com.google.android, whereas this tool uses android.android to
avoid overlap.
This means that when using the Maven Android SDK deployer your pom.xml should reference the artifact like this -
<dependency>
<groupId>android</groupId>
<artifactId>android</artifactId>
<version>4.4.2_r2</version>
<scope>provided</scope>
</dependency>
Note: the 4.4_r1 is no longer shipped in the Android SDK as it has been replaced by 4.4.2_r2.
The 4.1.1.4 version was the last com.google.android:android version uploaded to Maven Central, that's why it's the latest one you can reference using com.google.android:android.
Related
I am using Intellij IDEA 2021.3.1 Community edition on Linux for one of my Maven project. In the pom.xml file, there is a dependency with system scope having version 3.0-20211116.183306-362 as mentioned below:
<dependency>
<groupId>com.wd.xml</groupId>
<artifactId>wdXml</artifactId>
<scope>system</scope>
<systemPath>/home/mylib/wdXml-3.0-20211116.183306-362.jar</systemPath>
<version>3.0-20211116.183306-362</version>
</dependency>
The pom.xml does not have any issue, and mvn package command runs fine. However, the editor shows compilation errors in the Java class using this dependency.
Upon hours of digging, I found that in the 'Project Dependencies View' Intellij lists this dependency as com.wd.xml:wdXml:3.0-SNAPSHOT instead of com.wd.xml:wdXml:3.0-20211116.183306-362.
UPDATE
I believe it is because of this Maven convention
version if you distribute it, then you can choose any typical version with numbers and dots (1.0, 1.1, 1.0.1, ...). Don't use dates as they are usually associated with SNAPSHOT (nightly) builds. If it's a third party artifact, you have to use their version number whatever it is, and as strange as it can look. For example,
2.0, 2.0.1, 1.3.1
How do I resolve this? Is there any setting in the IDE that can be tweaked.
I am trying to upgrade a project from JDK 7 to JDK 8.
In order to fix some issues during compile time, I needed to upgrade Maven to 3.6.3 as well.
The other issue is fixed with this upgrade however, I am getting the below error during mvn install
Failed to execute goal on project jbossha-PATCH: Could not resolve dependencies for project com.company.wae:jbossha-PATCH:jar:5.1.0.GA: Could not find artifact sun-jaxb:jaxb-api:jar:2.2 in central (https://repo.maven.apache.org/maven2) -> [Help 1]
When I check my m2 repo, the jax-api.jar is present under sun-jaxb folder. If I delete sun-jaxb, it is created again with jax-api.jar.
This dependency is present in a lot pom.xml within the project.
Why the error is saying that it can not find the artifact and is there a way to solve this issue?
Why the error is saying that it can not find the artifact and is there a way to solve this issue?
Because the dependency in the POM files is incorrect. I checked, and there are no official dependencies for "sun-jaxb" in Maven Central.
The correct Maven dependency for the JAXB apis in Java 8 is
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.8</version>
<scope>provided</scope>
</dependency>
as described in "https://stackoverflow.com/questions/63608553". I checked and the artifact is there, as are older and newer versions.
So a good solution would be to update all of the POM dependencies.
Now I presume that you are trying to build was building correctly before you started porting it. (Did you check?) If it was, then it must having been getting the "sun-jaxb:jaxb-api:jar:2.2" dependency from ... somewhere:
It might have been in Maven Central "unofficially" and removed as a result of a clean-up
You (or the previous maintainer) might have installed it directly into the local repo on your build box.
You might have been getting it from another repo; e.g. a corporate Maven repo where someone has previously uploaded it.
It would be a good idea to figure out how it worked before.
I have some non maven jars in .m2 local repository. Whenever there is a change in the non maven project, I run the build and generate a newer version of jar in the repository. Is it possible to ask maven to get the latest version of jar from the local repository without explicitly mentioning the version of the dependency in pom.xml ? What would be the suggested approach to do this ?
How do the files get to the repository? If you install the files with maven install and use a SNAPSHOT version the maven build will generally use the newest version. If you are using a different manual versioning like 1.2.3, 1.2.4 and so on you can use an open interval in the pom like
<dependency>
<groupId>yourGroup</group>
<artifactId>yourArtifact</artifactId>
<version>[1.2.3,)</version>
</dependency>
There is also a lot of documentation on this topic i.e. How do I tell Maven to use the latest version of a dependency?
I have to write a plug-in for Atlassian Confluence by using Atlassian SDK and and Java's SDK v8 on Eclipse IDE. Apache Maven (3.2.1) comes with Atlassian SDK which I have to use it from there (because there are a couple of dependencies that are shipped with the sdk that are not available in a maven repository); so I set the environment variables to point in there. Although, the POM file that I have to use comes with errors.
For example:
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.2-atlassian-1</version> <!-- 2.2.2 -->
</dependency>
<dependency>
<groupId>com.atlassian.confluence</groupId>
<artifactId>confluence</artifactId>
<version>${confluence.version}</version>
</dependency>
On both dependencies it says, missing artifact, e.g.,
Missing artifact com.atlassian.confluence:confluence:jar:5.8.10
Although, in both cases, for example:
com.google.code.gson
the jar file at m2 actualy exists, yet the error at the POM file notifies that the artifact is missing.
I tried the atlas-mvn clean package, even after wiping the m2 repository explicitelly, and rerunning that command though it did not resolve the problems.
Did any body come across such a problem?
I needed to take each the *.repositories file under specific artifact dir (which causes problems), and perform following modifications, for example:
maven-confluence-plugin-6.2.2.jar>atlassian-public=
Needs to appear in the following format:
maven-confluence-plugin-6.2.2.jar>=
And it's done!
I'm working with a web app, called A, using maven, in eclipse, going between using m2e eclipse plugin and command line maven.
A depends on a custom library B, which is installed in the local repo. A details this dependency in its pom.xml
When I test the app in eclipse using eclipse's Tomcat, everything is fine -- the up-to-date version of B is used, and I see so in Maven dependencies folder.
But for some reason, when I go to command line and run mvn package, the resulting WAR uses out-dated version of B. I can tell because when I get it deployed to app server, its logging and functionality is broken in a specific way that was fixed in a newer version of B.
Is there any way for me to debug what's going on here? What is eclipse doing that mvn package is not including?
Project definition:
<groupId>org.com.web</groupId>
<artifactId>DocImgTransfer_Servlet</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
Dependency on lib that is somehow getting old version:
<dependency>
<groupId>DocImgTransfer</groupId>
<artifactId>DocImgTransfer</artifactId>
<version>1.0.0</version>
</dependency>
So really 3 questions:
If it is just some issue with maven grabbing the wrong version from local repo, is there a way for me to tell Maven to double-check the dependency version it's pulling in?
Will mvn clean or mvn package -U possibly help in this case at all?
Is the only advice to just double-check groupId, artifactId, version in pom.xml?
If it is just some issue with maven grabbing the wrong version from local repo, is there a way for me to tell Maven to double-check the dependency version it's pulling in?
a) Is your CustomatJar-1.0.0.jar version that eclipse is referring to same as maven is picking up or is maven picking up an older version?
i.e. Do you own the code for CustomatJar and are you just updating it v/s the one getting packed in war is truly an older version e.g. CustomatJar-0.0.5
i) You could tell by just unzipping the war and seeing which version is packed inside the jar.
ii) mvn dependency:dependency would tell you which dependencies maven command line thinks should be packed. more info
Is the only advice to just double-check groupId, artifactId, version in pom.xml?
Could you server have got an older version of CustomatJar in say it's lib?
You did double check your POM.xml already ... correct?