I'm trying to use the ivy-maven-plugin in order to execute SBT launcher from another Scala program that builds with Maven. (Side note: I'm not looking for answers like: use SBT...)
My ivyconf.xml looks like this:
<ivysettings>
<property name='ivy.checksums' value=''/>
<resolvers>
<url name='typesafe-repo' alwaysCheckExactRevision='yes' checkmodified='true'>
<ivy pattern='http://repo.typesafe.com/typesafe/releases/[organization]/[module]/[revision]/ivys/ivy.xml'/>
<artifact pattern='http://repo.typesafe.com/typesafe/releases/[organization]/[module]/[revision]/jars/[artifact](.[ext])'/>
</url>
<ibiblio name="maven2-repo" m2compatible="true"/>
</resolvers>
<modules>
<module organisation='com.jcraft' matcher='regexp' resolver='maven2-repo'/>
<module organisation='jline' matcher='regexp' resolver='maven2-repo'/>
<module organisation='org.apache.ivy' matcher='regexp' resolver='maven2-repo'/>
<module organisation='org.scalacheck' matcher='regexp' resolver='maven2-repo'/>
<module organisation='org.scala-lang' matcher='regexp' resolver='maven2-repo'/>
<module organisation='org.scala-sbt' name='test-interface' matcher='regexp' resolver='maven2-repo'/>
<module organisation='org.scala-sbt' matcher='regexp' resolver='typesafe-repo'/>
<module organisation='org.scala-tools.sbinary' matcher='regexp' resolver='typesafe-repo'/>
<module organisation='org.scala-tools.testing' matcher='regexp' resolver='maven2-repo'/>
<module organisation='org.sonatype.oss' matcher='regexp' resolver='maven2-repo'/>
<module organisation='org.specs2' matcher='regexp' resolver='maven2-repo'/>
</modules>
</ivysettings>
And the Maven plugin definition like this:
<plugin>
<groupId>com.github.goldin</groupId>
<artifactId>ivy-maven-plugin</artifactId>
<version>0.2.5</version>
<executions>
<execution>
<id>add-idea-artifacts-compile-scope</id>
<goals>
<goal>ivy</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<ivyconf>${project.basedir}/src/main/resources/ivyconf.xml</ivyconf>
<scope>compile</scope>
<dependencies>
<dependency>
<groupId>ivy.org.scala-sbt</groupId>
<artifactId>launcher</artifactId>
<version>0.13.0-RC4</version>
<!--<classifier>???</classifier>-->
</dependency>
</dependencies>
</configuration>
</execution>
</executions>
</plugin>
When I execute the build, I get:
[ERROR] Failed to execute goal com.github.goldin:ivy-maven-plugin:0.2.5:ivy
(add-idea-artifacts-compile-scope) on project escalante-play:
Execution add-idea-artifacts-compile-scope of goal com.github.goldin:ivy-maven-plugin:0.2.5:ivy failed:
Multiple artifacts resolved for [org.scala-sbt:launcher:0.13.0-RC4:jar] -
[ivy.org.scala-sbt:launcher:jar:launcher:0.13.0-RC4:compile,
ivy.org.scala-sbt:launcher-interface:jar:launcher-interface:0.13.0-RC4:compile,
ivy.org.apache.ivy:ivy:jar:ivy:2.3.0-rc1:compile,
ivy.org.scala-sbt:io:jar:io:0.13.0-RC4:compile,
ivy.org.scala-sbt:control:jar:control:0.13.0-RC4:compile,
ivy.org.scalacheck:scalacheck_2.10:jar:scalacheck_2.10:1.10.0:compile,
ivy.org.scala-tools.testing:test-interface:jar:test-interface:0.5:compile,
ivy.org.scala-lang:scala-actors:jar:scala-actors:2.10.1:compile,
ivy.org.specs2:specs2_2.10:jar:specs2_2.10:1.12.3:compile,
ivy.org.specs2:specs2-scalaz-core_2.10.0-RC3:jar:specs2-scalaz-core_2.10.0-RC3:6.0.1:compile,
ivy.org.scala-lang:scala-reflect:jar:scala-reflect:2.10.2:compile,
ivy.org.scala-sbt:interface:jar:interface:0.13.0-RC4:compile],
specify <classifier> so that only one artifact is resolved. -> [Help 1]
I assume I need to use a classified but I've no idea really what this classifier really should contain. I tried launcher but did not work, any other ideas?
Cheers,
Galder
Related
I have two EAR (ear01-0.0.1-SNAPSHOT.ear, ear02-0.0.1-SNAPSHOT.ear) applications and both of them are useing a common library (common-0.0.1-SNAPSHOT.jar). I decided to move out that common part and add it as module to a Wildfly 14 but even with a deployment descritor I get exception during the EAR deployment:
java.lang.NoClassDefFoundError: Failed to link ki/wildfly_deps/ejbs01/EchoBean01
I used this CLI to add the new module:
module add --name=ki.wildfly_deps.common --resources=common-0.0.1-SNAPSHOT.jar
and the JAR now is in
$JBOSS_HOME/modules/ki/wildfly_deps/common/main
1. QUESTION
This JAR shouldn't be in folder
$JBOSS_HOME/modules/system/layers/base/ki/wildfly_deps/common/main
beside the other modules?
After adding the module, the module.xml look like this:
<?xml version='1.0' encoding='UTF-8'?>
<module xmlns="urn:jboss:module:1.1" name="ki.wildfly_deps.common">
<resources>
<resource-root path="common-0.0.1-SNAPSHOT.jar"/>
</resources>
</module>
The jboss-deployment-structure.xml from each EAR declares a dependency on the above common library:
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<deployment>
<dependencies>
<module name="ki.wildfly_deps.common" />
</dependencies>
</deployment>
2. QUESTION
Should I specify the package what must be imported from the common module?
<jboss-deployment-structure
xmlns="urn:jboss:deployment-structure:1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<deployment>
<dependencies>
<module name="ki.wildfly_deps.common" //>
<imports>
<include path="META-INF**" />
<include path="ki.wildfly_deps.common**" />
</imports>
</module>
</dependencies>
</deployment>
I'm trying to install neo4j-jdbc-driver-3.3.1 as a module on Wildfly 11. I created the folders org/neo4j/driver/main and added the module.xml file as following:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.5" name="org.neo4j.driver">
<resources>
<resource-root path="neo4j-jdbc-driver-3.3.1.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
<module name="sun.jdk"/>
</dependencies>
</module>
I added the jar neo4j-jdbc-driver-3.3.1.jar in the same directory, but the module does not get deployed.
If I add the jar on the deployments folder it works, but I need the driver as a module.
I have been using intellij for 2 years now and love it. however after updating to 2016.3.4 it stopped highlighting path locations in the run window.
I used to be able to just click on the highlighted path and it would jump to the file and line.
example of output from maven-checkstyle-plugin which should be "clickable" :
[ERROR] C:\Users\userName\Documents\project.main\src\main\java\MyClass.java:36: Only one statement per line allowed. [OneStatementPerLine]
This is extremely frustrating and any idea of how to get intellij to do this again would be fantastic.
Minimal, Complete, and Verifiable example
To Replicate this Create a project in IntelliJ IDEA called "bug"
IntelliJ IDEA 2016.3.4
Build #IU-163.12024.16, built on January 31, 2017
Create a folder
bug->CodeStyle
and a file in this folder
"checkstyle.xml"
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name="Checker">
<property name="charset" value="UTF-8"/>
<property name="severity" value="error"/>
<property name="fileExtensions" value="java,"/>
<module name="FileTabCharacter"/>
<module name="TreeWalker">
<module name="RegexpSinglelineJava">
<property name="format" value="System\.(out|err).*?$"/>
<property name="ignoreComments" value="true"/>
</module>
</module>
</module>
the pom
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>bugExample</groupId>
<artifactId>bug</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.17</version>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<configuration>
<configLocation>CodeStyle/checkstyle.xml</configLocation>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
</configuration>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>6.18</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
and a Class Example.java
public class Example {
public Example() {
System.out.println("This is not allowed");
}
}
And now in the maven project Tool Click life-cycle, and then Validate.
The outputs in the "run terminal" :
[INFO] Starting audit...
[ERROR] C:\Users\Username\bug\src\main\java\Example.java:7: Line matches the illegal pattern 'System\.(out|err).*?$'. [RegexpSinglelineJava]
Audit done.
So the problem is that Example.java is Not "Clickable", it has been in the past.
Thanks for the example, I've reported a bug for IntelliJ IDEA Maven integration, feel free to vote:
IDEA-169034 File paths are not clickable in the Maven tool output
I am having problems using the new AmazonAWS SDK in a JBoss AS 7.1 (EE6) project
I am just using the S3 library, so in accordance with the new release (1.9.7) I am only using the s3, core, kms jars
-aws-java-sdk-core-1.9.17.jar
-aws-java-sdk-s3-1.9.17.jar
-aws-java-sdk-kms-1.9.17.jar
So I have created 3 separate module.xml entries for each jar within the /com/amazonaws directory:
/com/amazonaws/aws-java-sdk-s3/main/module.xml
<module xmlns="urn:jboss:module:1.1" name="com.amazonaws.aws-java-sdk-s3">
<properties>
<property name="jboss.api" value="private"/>
</properties>
<resources>
<resource-root path="aws-java-sdk-s3-1.9.17.jar"/>
<!-- Insert resources here -->
</resources>
<dependencies>
<module name="com.amazonaws.aws-java-sdk-core" />
<module name="com.amazonaws.aws-java-sdk-kms" />
</dependencies>
</module>
/com/amazonaws/aws-java-sdk-kms/main/module.xml
<resources>
<resource-root path="aws-java-sdk-kms-1.9.17.jar"/>
<!-- Insert resources here -->
</resources>
<dependencies>
<module name="com.amazonaws.aws-java-sdk-core" />
</dependencies>
/com/amazonaws/aws-java-sdk-core/main/module.xml
<module xmlns="urn:jboss:module:1.1" name="com.amazonaws.aws-java-sdk-core">
<properties>
<property name="jboss.api" value="private"/>
</properties>
<resources>
<resource-root path="aws-java-sdk-core-1.9.17.jar"/>
<resource-root path="commons-logging-1.1.3.jar"/>
<resource-root path="httpclient-4.3.4.jar"/>
<resource-root path="jackson-databind-2.3.2.jar"/>
<resource-root path="joda-time-2.2.jar"/>
<!-- Insert resources here -->
</resources>
</module>
(I have put the extra dependencies eg. apache-commons, jodatime etc. directly in the module directory)
The following jboss-deployment-structure.xml entry:
<sub-deployment name="Processor-ejb.jar">
<dependencies>
<module name="com.amazonaws.aws-java-sdk-core" />
<module name="com.amazonaws.aws-java-sdk-s3" />
<module name="com.amazonaws.aws-java-sdk-kms" />
</dependencies>
</sub-deployment>
(I have also tried declaring these as EAR-level dependancies with export=true)
The the following pom.xml entry:
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-s3</artifactId>
<version>1.9.17</version>
<scope>provided</scope>
</dependency>
But whenever I try to initialise a new S3 client:
AWSCredentials credentials = new ProfileCredentialsProvider("ProcessingApp").getCredentials();
AmazonS3 s3 = new AmazonS3Client(credentials);
I get the following exception:
Caused by: java.lang.NoClassDefFoundError: javax/management/MalformedObjectNameException
at com.amazonaws.jmx.SdkMBeanRegistrySupport.registerMetricAdminMBean(SdkMBeanRegistrySupport.java:27)
at com.amazonaws.metrics.AwsSdkMetrics.registerMetricAdminMBean(AwsSdkMetrics.java:330)
at com.amazonaws.metrics.AwsSdkMetrics.<clinit>(AwsSdkMetrics.java:308)
at com.amazonaws.services.s3.AmazonS3Client.<clinit>(AmazonS3Client.java:261)
at net.processor.actions.scheduled.ScheduledActionsBean.minuteActions(ScheduledActionsBean.java:79)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [classes.jar:1.6.0_65]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [classes.jar:1.6.0_65]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [classes.jar:1.6.0_65]
at java.lang.reflect.Method.invoke(Method.java:597) [classes.jar:1.6.0_65]
at org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java:72) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:374) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:44)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
at org.jboss.seam.intercept.Interceptor.aroundTimeout(Interceptor.java:201)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:74)
at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:79)
... 56 more
My hunch would be a conflict with apache-commons-logging as there is an import in the SdkMBeanRegistrySupport class and I know JBoss uses this library elsewhere using an alias to org.slf4j.jcl-over-slf4j, but I thought that putting the apache lib in with the jar would sort this out?
I am fairly new to AS7 so maybe I'm missing a trick?
Ok I got eventually thanks to #Federico Sierra, here is the sdk-core module.xml (nb. I had to drop the commons-logging, httpclient and httpcore jars into the module folder as the ones shipped with JBoss arent compatible, I added the jackson and joda libs as their own modules)...
<module xmlns="urn:jboss:module:1.1" name="com.amazonaws.aws-java-sdk-core">
<properties>
<property name="jboss.api" value="private"/>
</properties>
<resources>
<resource-root path="aws-java-sdk-core-1.9.17.jar"/>
<resource-root path="commons-logging-1.1.3.jar"/>
<resource-root path="httpclient-4.3.4.jar"/>
<resource-root path="httpcore-4.3.2.jar"/>
<!-- Insert resources here -->
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.xml.stream.api"/>
<module name="javax.xml.bind.api"/>
<module name="com.fasterxml.jackson"/>
<module name="org.joda.time"/>
</dependencies>
</module>
and the sdk-s3 module.xml needed javax.xml.stream.api too
<resources>
<resource-root path="aws-java-sdk-s3-1.9.17.jar"/>
<!-- Insert resources here -->
</resources>
<dependencies>
<module name="com.amazonaws.aws-java-sdk-core" />
<module name="com.amazonaws.aws-java-sdk-kms" />
<module name="javax.xml.stream.api"/>
</dependencies>
Hope this helps someone else
I want to share my code, it is working to me, I hope that it be useful to you
<module xmlns="urn:jboss:module:1.5" name="com.amazonaws.aws-java-sdk-s3">
<properties>
<property name="jboss.api" value="private"/>
</properties>
<resources>
<resource-root path="aws-java-sdk-s3-1.11.106.jar"/>
<resource-root path="aws-java-sdk-core-1.11.106.jar"/>
<resource-root path="aws-java-sdk-kms-1.11.106.jar"/>
<resource-root path="jmespath-java-1.11.106.jar"/>
<resource-root path="commons-logging-1.1.1.jar"/>
<resource-root path="httpclient-4.5.2.redhat-1.jar"/>
<resource-root path="httpcore-4.4.4.redhat-1.jar"/>
<resource-root path="jackson-annotations-2.8.9.redhat-1.jar"/>
<resource-root path="jackson-databind-2.8.9.redhat-1.jar"/>
<resource-root path="jackson-core-2.8.9.redhat-1.jar"/>
<resource-root path="jackson-dataformat-cbor-2.6.6.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.xml.bind.api"/>
<module name="javax.xml.stream.api"/>
<module name="org.joda.time"/>
</dependencies>
</module>
I use only a folder "com/amazonaws/aws-java-sdk-s3" in the jboss y there I put all the jars.
I'm using the Maven EAR plugin to generate the application.xml of my EAR, which contains a WAR.
I want the contextRoot of that WAR to be determined at runtime (this works thanks to JBoss AS 7), so the application.xml should contain something like this:
<module>
<web>
<web-uri>my.war</web-uri>
<context-root>${my.context.root}</context-root>
</web>
</module>
This works by setting the System Property my.context.root within JBoss AS 7 and configuring JBoss to replace variables within XML descriptor files:
<system-properties>
<property name="my.context.root" value="/foo"/>
</system-properties>
<subsystem xmlns="urn:jboss:domain:ee:1.1">
<spec-descriptor-property-replacement>true</spec-descriptor-property-replacement>
<jboss-descriptor-property-replacement>true</jboss-descriptor-property-replacement>
</subsystem>
If I do this by editing the generated application.xml in the EAR, it works.
However, I can't get Maven to write ${my.context.root} into the context root within application.xml.
I tried this first (since nothing is filtered, it should work):
<configuration>
<modules>
<webModule>
<groupId>my.group</groupId>
<artifactId>my-war</artifactId>
<contextRoot>${my.context.root}</contextRoot>
</webModule>
</modules>
</configuration>
Apparently, even though filtering defaults to false, Maven still thinks it should use this as Maven property. The result is that the EAR plugin just puts in the WAR's name:
<module>
<web>
<web-uri>my-war.war</web-uri>
<context-root>/my-war</context-root>
</web>
</module>
So I tried escaping:
<configuration>
<modules>
<webModule>
<groupId>my.group</groupId>
<artifactId>my-war</artifactId>
<contextRoot>\${my.context.root}</contextRoot>
</webModule>
</modules>
</configuration>
This is then taken literally:
<module>
<web>
<web-uri>my-war.war</web-uri>
<context-root>\${my.context.root}</context-root>
</web>
</module>
How can I get Maven to do what I want? (Of course, I could try to hack application.xml by using the Maven replacer plugin, but that's ugly...)
Thanks for any hints!
Well, since nobody knows a better answer, here's how I hacked application.xml into shape:
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<executions>
<execution>
<id>replace-escaped-context-root</id>
<phase>process-resources</phase>
<goals>
<goal>replace</goal>
</goals>
<configuration>
<file>${project.build.directory}/${project.build.finalName}/META-INF/application.xml</file>
<regex>false</regex>
<token>\${</token>
<value>${</value>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<configuration>
<modules>
<webModule>
<groupId>my.group</groupId>
<artifactId>my-war</artifactId>
<contextRoot>\${my.context.root}</contextRoot>
</webModule>
</modules>
</configuration>
</plugin>