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!
Related
I'm trying to add Stanford CoreNLP 3.9.2 as dependency to my Eclipse/Maven project:
<dependency>
<groupId>edu.stanford.nlp</groupId>
<artifactId>stanford-corenlp</artifactId>
<version>3.9.2</version>
</dependency>
Next to my POM.xml file I see a little red x icon. When I open POM.xml there is no additional information regarding the error.
When I click on Java -> Properties -> Java Build Path -> Maven Dependencies I see that the Jars that were expected to be added to Maven via this dependency are missing. This is odd because I regularly add dependencies this way without any error.
Apparently, something is preventing Maven from downloading the dependencies. What could it be?
Update:
I changed POM file to version 3.5.2 (instead of 3.9.2) and now all errors are gone.
If anyone can explain WHY this solved my problem (and how to make things work with version 3.9.2) I will accept it as the answer.
Update:
When I go to my Maven repository I see that most of the required Jars have been downloaded by Maven. For example, Maven repository will contain the folders: \\maven\.m2\repository\edu\stanford\nlp\stanford-corenlp\3.9.2 However the folder will not contain the Jar: stanford-corenlp-3.9.2 - but it will contain every other Jar such as stanford-corenlp-3.9.2-models and stanford-corenlp-3.9.2-sources etc.
This makes the whole situation even more confusing. If Maven is downloading the Jars why is it skipping just one Jar? I looked in several other folders (dependencies of corenlp) and I see similar phenomenon - it's always the main Jar of that folder that is missing.
What's worse, when I download and add the missing Jars manually to Maven folder, the (missing) text next to Jar goes away but there's still a little red x icon next to POM file. I have no idea what is going on.
Any insights?
Thanks!
I have no idea why this fixed the problem but in my POM file I had an entry:
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.debug.core</artifactId>
<version>3.13.0</version>
</dependency>
I update this dependency to:
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.debug.core</artifactId>
<version>3.14.0</version>
</dependency>
Now all errors have disappeared.
I am working with a maven project in eclipse which I have been testing using the built-in "run on server" tomcat option. When I try to do this, I get errors stating certain dependencies are unmet from an external jar I reference in the POM. However I have found if I add the jar via the DeploymentAssembly Tab I can run in eclipse without issues:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.company.user.server.UserDetailsAuthoritiesMapper#0'
The issue comes when I try to deploy on an actual tomcat instance. The Maven build runs fine, but when I start the servlet I get the same unmet dependency errors. This to me is indicating that the external jar is not being properly packaged into the war. What is the maven equivalent of adding the package via the DeploymentAssembly tab in eclipse? The entry in the POM.xml:
<dependency>
<groupId>com.company.webapp</groupId>
<artifactId>webapp-user</artifactId>
<version>106</version>
</dependency>
Thanks
You need to locate the maven info for the external jar. If you google the name of the jar and maven you often find a direct link to the block you need. For example if I want version 1.58 of the Bouncy castle jar Google "Maven BouncyCastle" you can find the artifact info. Add that info to your pom.xml as a new dependency in your block.
<!-- https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk15on -->
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.58</version>
</dependency>
After you rebuild, refresh maven in your IDE 1st after doing a clean, this will tell maven to pull down the jar and added it to your build.
You can also go to the repo directly and search:
Maven Repo: https://mvnrepository.com/
I'm trying to convert a "classic" JAVA EE project, using IBM websphere 8.0.0.5, into a maven multi module project and facing issues with the IBM dependecies.
We use IBM classes from the following packages:
com.ibm.websphere.asynchbeans
com.ibm.websphere.scheduler
com.ibm.websphere.ce.cm
com.ibm.ws.asynchbeans
com.ibm.ws.util.ThreadPool
To get my local project to be compiled I downloaded the was.installer-8.0.0.pm from IBM and installed it to my maven using
mvn install -f "was.installer-8.0.0.pom" -D serverInstallationFolder="C:\Program Files (x86)\IBM\WebSphere\AppServer"
This step was successfull according to command line output.
I then added the following dependencies to my project as described from IBM:
In parent:
<dependency>
<groupId>com.ibm.tools.target</groupId>
<artifactId>was</artifactId>
<version>8.0.0</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
In module:
<dependency>
<groupId>com.ibm.tools.target</groupId>
<artifactId>was</artifactId>
</dependency>
But I still can't compile my project as the IBM packages are not found.
Can anyone help me to find and correct a mistake I made?
Edit
After following BevynQ tip from the comments I copied the "was_public.jar" to "was_public-8.0.0.jar" (described at IBM here) and added it to my repository:
mvn install:install-file -Dfile="C:\Program Files (x86)\IBM\WebSphere\AppServer\dev\was_public-8.0.0.jar" -DpomFile="C:\Program Files (x86)\IBM\WebSphere\AppServer\dev\was_public-8.0.0.pom"
I then changed the dependencies to:
<dependency>
<groupId>com.ibm.websphere.appserver</groupId>
<artifactId>was_public</artifactId>
<version>8.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.ibm.websphere.appserver</groupId>
<artifactId>was</artifactId>
</dependency>
This helped to get the compiling errors for the imports to com.ibm.websphere done.
What I now have still open is the packages com.ibm.ws.* package. Anyone have an idea?
Edit 2
I added the following dependency and then I was rid of the com.ibm.ws.* import errors.
<dependency>
<groupId>com.ibm.websphere.ws</groupId>
<artifactId>com.ibm.ws.runtime</artifactId>
<version>1.0.0</version>
</dependency>
But it still does not compile as now indirectly references can not be found (in my case commonj.work.WorkManager). It seems I need to add further .jars for every single thing. Isn't there an easier way to provide all websphere jars at once as descirbe in the above linked tutorial with the com.ibm.toolsdependency (which do not work)?
In general, com.ibm.websphere are public API for use by applications (this is true of the packages you listed above) which is consistent with these being in was_public.jar
However, com.ibm.ws package is generally product internals. May I ask what interface methods you are using from the com.ibm.ws.asynchbeans package? Maybe there is a public API alternative.
Regarding commonj.work, the only place I can find this in the WebSphere Application Server product image is WAS/plugins/com.ibm.ws.prereq.commonj-twm.jar so it looks like you will need to use that to compile against.
Here's the solution so I solved my dependency problems:
I configured the company repository manager (nexus) as a mirror. In this nexus all ibm packages are present. As you can think that solved the main problem.
I then added the following dependencies according to common maven style:
Dependencies in pom.xml (version numbers extracted to properties):
<dependency>
<groupId>com.ibm.websphere.ws</groupId>
<artifactId>com.ibm.ws.runtime</artifactId>
<version>${ibm.ws.runtime.version}</version>
</dependency>
<dependency>
<groupId>com.ibm.ws.prereq</groupId>
<artifactId>commonj-twm</artifactId>
<version>${ibm.ws.prereq.commonj-twm.version}</version>
</dependency>
Sorry I can't provide a "nice" solution that's useable by all people but the answer from njr and the comment from BevynQ helped at lot to get clearer with the problem and helped to solve the problem in a "more manual" way by copying the needed jars by hand.
I was facing this issue as I tried to build a project using Maven version 3.3.9, running on Java version 1.8.0_101, as depicted in the screenshot:
This is how I resolved it: Step 1. Download the commonj.jar from here.
Step 2. Determine which JDK your Maven is using by typing mvn -version in the command prompt.
Step 3. Go to that directory and place the commonj.jar file there in the jre/lib/ext directory, as shown below. Now your project should build in maven without any issues.
I am working on a Java project, using maven as our dependency manager/build tool. I am currently having a problem resolving a dependency's dependency to the correct version.
The dependency in question is called jasperreports-functions-6.1.0.jar which is not hosted in a maven repo but provided in jar form.
The problem I'm having is that jasperreports-functions needs commons-lang 2.6. Inconveniently, during "compile" Maven itself builds commons-lang 2.1 to create the reduced-pom. It seems this leads to jasperreports-functions trying to use commons-lang 2.1 because it is available, but this is not valid (method undefined errors at runtime.)
I have tried adding commons-lang 2.6 as a dependency but still it seems jasperreports-functions is using the 2.1 version.
pom.xml snip:
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>6.1.0</version>
</dependency>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports-functions</artifactId>
<version>6.1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/jasperreports-functions-6.1.0.jar</systemPath>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
Using "mvn dependency:tree" I can see that no dependency requires commons-lang.
If I delete 2.1 from ".m2\repository\commons-lang\commons-lang" it gets recreated by maven. If I empty the folder and lock the permissions on it, then run maven again I get the error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.4:jar (default-jar) on project JavaLibrary: Execution default-jar of goal org.apache.maven.plugins:maven-jar-plugin:2.4:jar failed: Plugin org.apache.maven.plugins:maven-jar-plugin:2.4 or one of its dependencies could not be resolved: Failed to collect dependencies at org.apache.maven.plugins:maven-jar-plugin:jar:2.4 -> commons-lang:commons-lang:jar:2.1: Failed to read artifact descriptor for commons-lang:commons-lang:jar:2.1: Could not transfer artifact commons-lang:commons-lang:pom:2.1 from/to central (https://repo.maven.apache.org/maven2): C:\Users\Lowell\.m2\repository\commons-lang\commons-lang\2.1\commons-lang-2.1.pom.part.lock (Access is denied) -> [Help 1]
How can I force the jar dependency to use a certain version of a sub-dependency?
Have you tried to reorder the depency entries,
first to load commons-lang then to load jasperreports ?
Edit:
Maybe this should help you: dependency:analyze-dep-mgt
What you are doing should be enough. The newer version should override the older version AND the version you specify explicitly should override any transient dependency. I believe Maven 2.x had problems in this area which is why I updated to Maven 3.x
I suspect the problem is somewhere else. I suggest trying to delete common-lang 2.1 and I suspect this should show you what the real problem is.
Try this:
1> Maven clean.
2> Right click on project->maven -> update project configuration - > force update
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.