Why only part Metro Framework packages / artifacts renamed to jakarta and most stay in com.sun.xml? - soap

My Gradle WSLD Java source generation plugin still uses com.sun.xml.ws:jaxws-tools of v2.3.2-1. There is v4.0.0 too:
https://mvnrepository.com/artifact/com.sun.xml.ws/jaxws-tools
but there is no jaxws-tools artifact under new Jakarta umbrella:
https://mvnrepository.com/artifact/jakarta.xml.ws
I'm highly confused: Why transition to Jakarta / Eclipse led only to partial Maven coordinates changes, most of the EE XML/SOAP stuff still under the old com.sun.xml...
Seems that parent POM leads to:
mvn dependency:copy -Dartifact=com.sun.xml.ws:project:4.0.0:pom -DoutputDirectory=libs
<scm>
<connection>scm:git:git#github.com:eclipse-ee4j/metro-jax-ws.git</connection>
<developerConnection>scm:git:git#github.com:eclipse-ee4j/metro-jax-ws.git</developerConnection>
<url>https://github.com/eclipse-ee4j/metro-jax-ws</url>
<tag>HEAD</tag>
</scm>

Related

Circular Dependencies in Eclipse Platform

I'm trying to add the Eclipse Platform to my Maven project and stumbled over something very weird.
There is the plug-in org.eclipse.swt, which has a dependency org.eclipse.swt.${osgi.platform}, where ${osgi.platform} can be any of the following:
cocoa.macosc.cocoa
gtk.linux.aarch64
win32.win32.x86_64
However if you check the pom.xml of org.eclipse.swt.win32.win32.x86_64 you learn that this project has a dependency to org.eclipse.swt. Which forms a nice dependency circle, which is not allowed in Maven nor in OSGi.
Consequently I'm getting a StackOverflowError, but only if I try to use the maven-dependency-plugin with -Dosgi.platform=win32.win32.x86_64.
If I don't use that parameter I get the following exception:
No versions available for org.eclipse.platform:org.eclipse.swt.gtk.linux.aarch64:jar:[3.105.2,3.105.2]
(Which is probably okay, because I guess that Linux is the default value, but it doesn't apply to me, since I've got a Windows PC.)
I can't exclude the dependency either, e.g. with:
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.swt</artifactId>
<exclusions>
<exclusion>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.swt.gtk.linux.aarch64</artifactId>
</exclusion>
</exclusions>
</dependency>
I get the same error messages as above with that approach.
I'm wondering how the Eclipse guys even managed to release that mess, but more importantly: How do I build against a Maven project with circular dependencies like this?
You're looking at the wrong place. Eclipse artifacts are published in Eclipse p2 repositories. In addition, some Eclipse artifacts will be published in Maven repositories for use in plain (non-Eclipse based) Java applications which cannot be used to build Eclipse-based applications. Something seems to have gone wrong publishing Eclipse SWT to Maven Central causing the circular dependencies. Please report this to Eclipse.
The Eclipse IDE packages are built with the Maven plug-in Tycho. See for example the pom.xml file for the Eclipse platform or here the parent pom.xml for all IDE packages. Tycho uses one or more Eclipse p2 repositories to resolve dependencies. A Maven repository would not work to resolve Import-Package dependencies or product configurations, for example. In a Maven repository, an artifact has a version, while in a p2 repository also Java packages of the same JAR can have different versions. In a Maven Tycho pom.xml only the p2 repositories have to be specified, the dependencies are already declared in the META-INF/MANIFEST.MF, feature.xml and *.product files.

Can maven treat WEB-INF\lib the way eclipse (and m2e) does?

I have a servlet/jsp web project which runs fine on eclipse and is exported as war fine (once I clean it that is). I mavenized the project deleting all of the dependencies from the WEB-INF\lib folder except a homebrew jar (the output of another project in the workspace). When I run the package maven goal I get messages for missing classes from this jar:
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
#..... NOTICE THIS COMES FROM A CUSTOM JAR
[ERROR] /C:/path/DataServlet.java:[3,30] package xxx.java.helpers does not exist
Now this has been asked before and the most rigorous solution appears to be to create a local repo: Can I add jars to maven 2 build classpath without installing them? (NB: I am at maven 3).
I would like to avoid this - so is there any way maven will just stuff this jar to WEB-INF\lib in the war ?
Solutions that use some maven plugin to cp the contents of the WEB-INF\lib in the war are welcome - although I just have this feeling that there should be a solution that takes into account the "special" nature of this folder.
Observations:
Alt+F5 removes this line:
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
which corresponds to the "Web App libraries" in the Java Build Path. So not only maven refuses to take into account the WEB-INF\lib - it also breaks the build path of eclipse completely.
Related:
Maven: How to include jars in Eclipse, which are not available in repository?
Uses the maven eclipse plugin : update my classpath with an Eclipse User Library via the maven eclipse plugin - not compatible with m2e
How does the m2e eclipse plugin interact with eclipse? - apparently m2e checks the pom then calls the eclipse builders (hence the .classpath is read)
Eclipse maven-enabled web app references workspace projects, but those are not deployed when running Tomcat server
Deploying a Maven project with dependencies to Tomcat or Jboss running within Eclipse
Did you add this jar from WEB-INF\lib as a dependency like this:
<dependency>
<groupId>someGroupId</groupId>
<artifactId>someArtifactId</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/homebrew jar</systemPath>
</dependency>

WTP - m2e not deploying transitive dependencies

I have a web application which is structured in this way:
A.jar -> B.war -> C.war
I'm using Eclipse Juno and the WTP version is 1.1. The A.jar is a workspace utility project which is being included by B.war. B.war is a war project that is included by C.war as an overlay. That's the way I'm doing that:
<dependency>
<groupId>com.projects</groupId>
<artifactId>B</artifactId>
<version>1.0-SNAPSHOT</version>
<type>war</type>
<scope>runtime</scope>
</dependency>
After that, I deploy the C project to the Tomcat server. That works like a charm if I manually deploy the Maven generated war to the Tomcat, because A.jar is included in WEB-INF/lib. However my problem comes when I let m2e-wtp do the deploy, because it's doing the overlay properly but not including the A transitive dependency. I tried including it as a pom, as I read somewhere around here, but I have the same result.
<dependency>
<groupId>com.projects</groupId>
<artifactId>B</artifactId>
<version>1.0-SNAPSHOT</version>
<type>war</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.projects</groupId>
<artifactId>B</artifactId>
<version>1.0-SNAPSHOT</version>
<type>pom</type>
</dependency>
I'm using the newest versions of m2e (1.2) and m2e-wtp (0.16) and have my projects updated with the Maven configuration.
Is it an m2e-wtp issue or simply do I have to organize my project in other way?
EDITED
I noticed m2e-wtp configuration is stored into Eclipse's project./settings/org.eclipse.wst.common.component file. That's how it looks for my war:
<dependent-module deploy-path="/"
handle="module:/overlay/prj/B?includes=**/**&excludes=META-INF/MANIFEST.MF">
<dependency-type>consumes</dependency-type>
</dependent-module>
<dependent-module deploy-path="/"
handle="module:/overlay/slf/?includes=**/**&excludes=META-INF/MANIFEST.MF">
<dependency-type>consumes</dependency-type>
</dependent-module>
As I can see the war dependency is set for consume while the jar dependencies are set for use.
Released m2e-wtp version 0.17 doesn't seem to fix it.
EDITED (2013-08-30)
Today I was back to the same problem. Even I have Eclipse kepler installed with the latest stable release of WTP out of the box, this problem seems to persist. I thought it was solved, but I apparently mischeck it...
I think it is not a problem of your project organization. Your issue is very similar to this m2e-wtp bug report.
It seems to be a Eclipse Juno and WTP Plugin problem.
I had the same problem and i solved in this way:
Backup your eclipse workspace and your project code
remove your project from eclipse (without remove the contents)
open a command terminal (cmd)
run mvn eclipse:clean
run mvn eclipse:eclipse -Dwtpversion=2.0
edit your eclipse classpath file with a text editor: %PROJECT_PATH%\.classpath
remove all lines with attribute kind="var" from your .classpath file. For example:
< classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar" sourcepath="M2_REPO/javax/servlet/servlet-api/2.5/servlet-api-2.5-sources.jar"/>
save file & close editor.
in eclipse, click on: file->Import...->Maven->import existing maven project, and import your project again
Maven -> Update Project (if you want)
You could see on deployment assembly in eclipse project properties that problem is solved and the maven dependencies are there.
Hope this helps.
I also have this problem. I have an ugly workaround:
Put all the original war's dependencies in a separate project (type jar) and make both original war and overlay war depend on that. So for the example:
A.jar -> B.war -> C.war
becomes
A.jar -> B-dependencies.jar (new module called B-dependencies created)
B-dependencies.jar -> B.war
B-dependencies.jar -> C.war
Note that it's not specific to Tomcat; I'm using JBoss.

Eclipse error with osgi + maven + maven-pax-plugin

I am trying to create an OSGi bundle and integrate it into eclipse. I am using the maven-pax-plugin to create the bundles. These are the steps I follow
I create an osgi project using pax
mvn org.ops4j:maven-pax-plugin:create-project -DgroupId=org.sonatype.mcookbook -DartifactId=osgi-project -Dversion=1.0-SNAPSHOT
and then create a bundle
mvn pax:create-bundle -Dpackage=org.sonatype.mcookbook -Dname=osgi-bundle -Dversion=1.0-SNAPSHOT
and then try to import the maven project into eclipse (file/import/existing maven project) the bundle project created in the second step always gives me this error
maven-pax-plugin:1.5:compile (1 error)
Execution default-compile, in org.sonatype.mcookbook/pom.xml
maven-pax-plugin:1.5:testCompile (1 error)
Execution default-testCompile, in org.sonatype.mcookbook/pom.xml
When I select one of the errors the description says
No marketplace entries found to handle Execution default-compile, in org.sonatype.mcookbook/pom.xml in Eclipse. Please see Help for more information.
If i ignore the error and import the project anyway this is what eclipse complains about
Plugin execution not covered by lifecycle configuration: org.ops4j:maven-pax-plugin:1.5:compile (execution: default-compile, phase: compile)
Has anyone seen this? any ideas how to fix it?
I am following this tutorial but adding integration with eclipse. Note however that if I build it with maven and don't use eclipse at all it all works fine, the problem is in eclipse/m2e
I am using Eclipse Indigo SR2 and m2e 1.0.200
I get rid of this problem by following the comment in the generated POM and move the <extensions>true</extensions> down to the maven-bundle-plugin below giving:
...
<plugins>
<plugin>
<groupId>org.ops4j</groupId>
<artifactId>maven-pax-plugin</artifactId>
<version>1.4</version>
<!--
| enable improved OSGi compilation support for the bundle life-cycle.
| to switch back to the standard bundle life-cycle, move this setting
| down to the maven-bundle-plugin section
-->
<!-- WAS HERE -->
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>1.4.3</version>
<!--
| the following instructions build a simple set of public/private
| classes into an OSGi bundle
-->
<extensions>true</extensions> <!-- MOVED HERE :-) -->
<configuration>
...
Then update the project (Right click on project name in Project Explorer: Maven -> Update Project...), wait for the build to complete and the error is gone.
Hope that helps!
The new m2eclipse versions require that every plugin that affects the build is supported using a m2eclipse plugin. So the maven-pax-plugin is not yet supported. As this basically happens with most maven plugins out there I still use the old m2eclipse version.
Unfortunately the old version 0.12 download seems to have been removed recently. So probably you will have to wait till maven-pax-plugin is supported.

Setup Tomcat libraries dependencies in maven POM

I am currently migrating our build process from Eclipse/Ant to Maven/M2Eclipse/Artifactory.
I have a Webapp as a WTP project in Eclipse.
I have migrated it to Maven with m2eclipse.
The compilation runs fine from the Eclipse IDE.
However, when I try to compile from Maven CLI (mvn clean & mvn compile), Maven complains about not finding the libraries provided by the Tomcat Environment (like annotations-api, servlet-api, etc, ...).
Fair enough : Indeed, these dependencies are provided by WTP, as Java resources / Libraries / ApacheTomcat6. Maven is not aware of them.
I could deactivate this in the build path, and add each corresponding dependency in my POM, but I'm afraid this would lead Maven to deploy them again in my webapp (WEB-INF/libs).
So, what is the good way to say to maven "this application will run in a well known environment, providing the following libraries ". Is there some common Tomcat POM that I could add as a dependency ?
Thanks in advance for your advice.
regards,
Raphael
One way to handle this is to declare these dependencies with scope provided. These dependencies will be available for compile and test, but will not be packaged by maven into the webapp. For example,
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>